// Copyright 2016 Tom Thorogood. All rights reserved.// Use of this source code is governed by a// Modified BSD License license that can be found in// the LICENSE file.// +build amd64,!gccgo,!appenginepackage heximport// RawEncode encodes src into EncodedLen(len(src))// bytes of dst. As a convenience, it returns the number// of bytes written to dst, but this value is always EncodedLen(len(src)).// RawEncode implements hexadecimal encoding for a given alphabet.func (, , []byte) int {iflen() != 16 {panic("invalid alphabet") }iflen() < len()*2 {panic("dst buffer is too small") }iflen() == 0 {return0 }switch {casecpu.X86.HasAVX:encodeAVX(&[0], &[0], uint64(len()), &[0])casecpu.X86.HasSSE41:encodeSSE(&[0], &[0], uint64(len()), &[0])default:encodeGeneric(, , ) }returnlen() * 2}// Decode decodes src into DecodedLen(len(src)) bytes, returning the actual// number of bytes written to dst.//// If Decode encounters invalid input, it returns an error describing the failure.func (, []byte) (int, error) {iflen()%2 != 0 {return0, errLength }iflen() < len()/2 {panic("dst buffer is too small") }iflen() == 0 {return0, nil }var (uint64bool )switch {casecpu.X86.HasAVX: , = decodeAVX(&[0], &[0], uint64(len()))casecpu.X86.HasSSE41: , = decodeSSE(&[0], &[0], uint64(len()))default: , = decodeGeneric(, ) }if ! {return0, InvalidByteError([]) }returnlen() / 2, nil}//go:generate go run asm_gen.go// This function is implemented in hex_encode_amd64.s//go:noescapefunc ( *byte, *byte, uint64, *byte)// This function is implemented in hex_encode_amd64.s//go:noescapefunc ( *byte, *byte, uint64, *byte)// This function is implemented in hex_decode_amd64.s//go:noescapefunc ( *byte, *byte, uint64) ( uint64, bool)// This function is implemented in hex_decode_amd64.s//go:noescapefunc ( *byte, *byte, uint64) ( uint64, bool)
The pages are generated with Goldsv0.4.9. (GOOS=linux GOARCH=amd64)