// DecodeUint8 reads the next JSON-encoded value from the decoder's input (io.Reader) and stores it in the uint8 pointed to by v.
//
// See the documentation for Unmarshal for details about the conversion of JSON into a Go value.
480913
func (dec *Decoder) DecodeUint8(v *uint8) error {
	if dec.isPooled == 1 {
		panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder"))
	}
	return dec.decodeUint8(v)
}
617472
func UInt16FromUInt8(highByte byte, lowByte byte) uint16 {
	return uint16(uint16(highByte)<<8) | uint16(lowByte)
}
896486
func DecodeUints(s string) ([]uint, error) {
	xs := make([]uint, 0)
	var x, shift uint
	for i, c := range []byte(s) {
		switch {
		case 63 <= c && c < 95:
			xs = append(xs, x+(uint(c)-63)<<shift)
			x = 0
			shift = 0
		case 95 <= c && c < 127:
			x += (uint(c) - 95) << shift
			shift += 5
		default:
			return nil, &InvalidCharacterError{i, c}
		}
	}
	if shift != 0 {
		return nil, &UnterminatedError{}
	}
	return xs, nil
}
1272328
func MinUint8N(v ...uint8) uint8 {
	switch len(v) {
	case 0:
		return 0
	case 1:
		return v[0]
	case 2:
		return MinUint8(v[0], v[1])
	default:
		l := len(v) / 2
		return MinUint8N(MinUint8N(v[:l]...), MinUint8N(v[l:]...))
	}
}
48544
func (iter *Iterator) ReadUint() uint {
	if strconv.IntSize == 32 {
		return uint(iter.ReadUint32())
	}
	return uint(iter.ReadUint64())
}
294082
func EncodeUint(b []byte, v uint64) []byte {
	var data [8]byte
	binary.BigEndian.PutUint64(data[:], v)
	return append(b, data[:]...)
}
789173
func Decode(b []byte) (int64, int) {
	if len(b) == 0 {
		return 0, 0
	}
	// 0xxxxxxx 7-bit positive number
	if (b[0] & 0x80) == 0 {
		return int64(b[0]), 1
	}
	// 10xxxxxx + 1 byte 14-bit positive number
	if (b[0]&0xC0) == 0x80 && len(b) >= 2 {
		return int64(b[0]&0x3F)<<8 | int64(b[1]), 2
	}
	// 110xxxxx + 2 bytes 21-bit positive number
	if (b[0]&0xE0) == 0xC0 && len(b) >= 3 {
		return int64(b[0]&0x1F)<<16 | int64(b[1])<<8 | int64(b[2]), 3
	}
	// 1110xxxx + 3 bytes 28-bit positive number
	if (b[0]&0xF0) == 0xE0 && len(b) >= 4 {
		return int64(b[0]&0xF)<<24 | int64(b[1])<<16 | int64(b[2])<<8 | int64(b[3]), 4
	}
	// 111100__ + int (32-bit) 32-bit positive number
	if (b[0]&0xFC) == 0xF0 && len(b) >= 5 {
		return int64(binary.BigEndian.Uint32(b[1:])), 5
	}
	// 111101__ + long (64-bit) 64-bit number
	if (b[0]&0xFC) == 0xF4 && len(b) >= 9 {
		return int64(binary.BigEndian.Uint64(b[1:])), 9
	}
	// 111110__ + varint Negative recursive varint
	if b[0]&0xFC == 0xF8 {
		if v, n := Decode(b[1:]); n > 0 {
			return -v, n + 1
		}
		return 0, 0
	}
	// 111111xx Byte-inverted negative two bit number (~xx)
	if b[0]&0xFC == 0xFC {
		return ^int64(b[0] & 0x03), 1
	}

	return 0, 0
}
937228
func reverseUint32(v uint32) (x uint32) {
	x |= uint32(reverseLUT[byte(v>>0)]) << 24
	x |= uint32(reverseLUT[byte(v>>8)]) << 16
	x |= uint32(reverseLUT[byte(v>>16)]) << 8
	x |= uint32(reverseLUT[byte(v>>24)]) << 0
	return x
}
425705
func PutUint8(b []byte, v uint8) {
	if l := len(b); l != 1 {
		panic(fmt.Sprintf("PutUint8: unexpected byte slice length: %d", l))
	}

	b[0] = v
}
623802
func (e *Encoder) EncodeUint(n uint64) error {
	if n <= math.MaxInt8 {
		return e.w.WriteByte(byte(n))
	}
	if n <= math.MaxUint8 {
		return e.EncodeUint8(uint8(n))
	}
	if n <= math.MaxUint16 {
		return e.EncodeUint16(uint16(n))
	}
	if n <= math.MaxUint32 {
		return e.EncodeUint32(uint32(n))
	}
	return e.EncodeUint64(uint64(n))
}
232539
func Uint8(b []byte) uint8 {
	if l := len(b); l != 1 {
		panic(fmt.Sprintf("Uint8: unexpected byte slice length: %d", l))
	}

	return b[0]
}
148097
func (bigEndian) ReadUint16(b io.ByteReader) (uint16, error) {
	var b1, b2 uint8
	var err error
	if b2, err = b.ReadByte(); err != nil {
		return 0, err
	}
	if b1, err = b.ReadByte(); err != nil {
		return 0, err
	}
	return uint16(b1) + uint16(b2)<<8, nil
}
1324228
func (a *Array) Uint8(i uint8) *Array {
	a.buf = enc.AppendUint8(enc.AppendArrayDelim(a.buf), i)
	return a
}
77151
func ParseUint(s []byte, base int, bitSize int) (n uint64, err error) {
	if len(s) == 1 {
		switch s[0] {
		case '0':
			return 0, nil
		case '1':
			return 1, nil
		case '2':
			return 2, nil
		case '3':
			return 3, nil
		case '4':
			return 4, nil
		case '5':
			return 5, nil
		case '6':
			return 6, nil
		case '7':
			return 7, nil
		case '8':
			return 8, nil
		case '9':
			return 9, nil
		}
	}
	return internal.ParseUint(s, base, bitSize)
}
682835
func randomUint64(r io.Reader) (uint64, error) {
	rv, err := binarySerializer.Uint64(r, bigEndian)
	if err != nil {
		return 0, err
	}
	return rv, nil
}
845314
func ReadUInt8(
	clientAddr chan<- protocol.Addr,
	clientData <-chan protocol.ReadData,
	bufferedAccess bool,
	readAddr uintptr) uint8 {

	// Issue read request.
	go func() {
		clientAddr <- protocol.Addr{
			Addr:  readAddr,
			Size:  [3]bool{false, false, false},
			Burst: [2]bool{true, false},
			Cache: [4]bool{bufferedAccess, true, false, false}}
	}()

	// Select data from 64-bit read result.
	readResp := <-clientData
	var readData uint8
	switch byte(readAddr) & 0x7 {
	case 0x0:
		readData = uint8(readResp.Data)
	case 0x1:
		readData = uint8(readResp.Data >> 8)
	case 0x2:
		readData = uint8(readResp.Data >> 16)
	case 0x3:
		readData = uint8(readResp.Data >> 24)
	case 0x4:
		readData = uint8(readResp.Data >> 32)
	case 0x5:
		readData = uint8(readResp.Data >> 40)
	case 0x6:
		readData = uint8(readResp.Data >> 48)
	default:
		readData = uint8(readResp.Data >> 56)
	}
	// TODO: return !readResp.Resp[1], readData
	return readData
}
160403
func (b *NullByteSizeInMb) ParseUint64Value(val *uint64) {
	if val == nil {
		b.IsSet = false
		b.Value = 0
		return
	}

	b.Value = *val
	b.IsSet = true
}