// Code generated by mkint, DO NOT EDIT.

package jx

import (
	
	
	

	
)

var errOverflow = strconv.ErrRange

const (
	uint8SafeToMultiple10  = uint8(0xff)/10 - 1
	uint16SafeToMultiple10 = uint16(0xffff)/10 - 1
	uint32SafeToMultiple10 = uint32(0xffffffff)/10 - 1
	uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1
)

// UInt8 reads uint8.
func ( *Decoder) () (uint8, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	return .readUInt8()
}

func ( *Decoder) ( byte) (uint8, error) {
	 := floatDigits[]
	switch  {
	case 0:
		// Check that next byte is not a digit.
		,  := .peek()
		if  == nil {
			switch floatDigits[] {
			case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "digit after leading zero")
			case dotInNumber, expInNumber, plusInNumber, minusInNumber:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "unexpected floating point character")
			case invalidCharForNumber:
				return 0, badToken(, .offset())
			}
		}
		return 0, nil // single zero
	default:
		if  < 0 {
			return 0, badToken(, .offset()-1)
		}
	}
	 := uint8()
	if .tail-.head > 3 {
		 := .head
		// Iteration 0.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+0)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+0)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1
			return , nil
		}
		++
		// Iteration 1.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+1)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+1)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10
			 += uint8() * 1
			return , nil
		}
		++
		// Iteration 2.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+2)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+2)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100
			 += uint8() * 10
			 += uint8() * 1
			return , nil
		}
		.head = 
		 *= 100
		 += uint8() * 10
		 += uint8() * 1
	}
	for {
		 := .buf[.head:.tail]
		for ,  := range  {
			 = floatDigits[]
			switch  {
			case invalidCharForNumber:
				return 0, badToken(, .offset()+)
			case dotInNumber,
				expInNumber,
				plusInNumber,
				minusInNumber:
				 := badToken(, .offset()+)
				return 0, errors.Wrap(, "unexpected floating point character")
			case endOfNumber:
				.head += 
				return , nil
			}
			if  > uint8SafeToMultiple10 {
				 := ( << 3) + ( << 1) + uint8()
				if  <  {
					return 0, errOverflow
				}
				 = 
				continue
			}
			 = ( << 3) + ( << 1) + uint8()
		}
		switch  := .read();  {
		case io.EOF:
			return , nil
		case nil:
			continue
		default:
			return 0, 
		}
	}
}

// Int8 reads int8.
func ( *Decoder) () (int8, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	if  == '-' {
		,  := .byte()
		if  != nil {
			return 0, 
		}
		,  := .readUInt8()
		if  != nil {
			return 0, 
		}
		if  > math.MaxInt8+1 {
			return 0, errOverflow
		}
		return -int8(), nil
	}
	,  := .readUInt8()
	if  != nil {
		return 0, 
	}
	if  > math.MaxInt8 {
		return 0, errOverflow
	}
	return int8(), nil
}

// UInt16 reads uint16.
func ( *Decoder) () (uint16, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	return .readUInt16()
}

func ( *Decoder) ( byte) (uint16, error) {
	 := floatDigits[]
	switch  {
	case 0:
		// Check that next byte is not a digit.
		,  := .peek()
		if  == nil {
			switch floatDigits[] {
			case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "digit after leading zero")
			case dotInNumber, expInNumber, plusInNumber, minusInNumber:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "unexpected floating point character")
			case invalidCharForNumber:
				return 0, badToken(, .offset())
			}
		}
		return 0, nil // single zero
	default:
		if  < 0 {
			return 0, badToken(, .offset()-1)
		}
	}
	 := uint16()
	if .tail-.head > 5 {
		 := .head
		// Iteration 0.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+0)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+0)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1
			return , nil
		}
		++
		// Iteration 1.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+1)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+1)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10
			 += uint16() * 1
			return , nil
		}
		++
		// Iteration 2.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+2)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+2)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100
			 += uint16() * 10
			 += uint16() * 1
			return , nil
		}
		++
		// Iteration 3.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+3)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+3)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1000
			 += uint16() * 100
			 += uint16() * 10
			 += uint16() * 1
			return , nil
		}
		++
		// Iteration 4.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+4)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+4)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10000
			 += uint16() * 1000
			 += uint16() * 100
			 += uint16() * 10
			 += uint16() * 1
			return , nil
		}
		.head = 
		 *= 10000
		 += uint16() * 1000
		 += uint16() * 100
		 += uint16() * 10
		 += uint16() * 1
	}
	for {
		 := .buf[.head:.tail]
		for ,  := range  {
			 = floatDigits[]
			switch  {
			case invalidCharForNumber:
				return 0, badToken(, .offset()+)
			case dotInNumber,
				expInNumber,
				plusInNumber,
				minusInNumber:
				 := badToken(, .offset()+)
				return 0, errors.Wrap(, "unexpected floating point character")
			case endOfNumber:
				.head += 
				return , nil
			}
			if  > uint16SafeToMultiple10 {
				 := ( << 3) + ( << 1) + uint16()
				if  <  {
					return 0, errOverflow
				}
				 = 
				continue
			}
			 = ( << 3) + ( << 1) + uint16()
		}
		switch  := .read();  {
		case io.EOF:
			return , nil
		case nil:
			continue
		default:
			return 0, 
		}
	}
}

// Int16 reads int16.
func ( *Decoder) () (int16, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	if  == '-' {
		,  := .byte()
		if  != nil {
			return 0, 
		}
		,  := .readUInt16()
		if  != nil {
			return 0, 
		}
		if  > math.MaxInt16+1 {
			return 0, errOverflow
		}
		return -int16(), nil
	}
	,  := .readUInt16()
	if  != nil {
		return 0, 
	}
	if  > math.MaxInt16 {
		return 0, errOverflow
	}
	return int16(), nil
}

// UInt32 reads uint32.
func ( *Decoder) () (uint32, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	return .readUInt32()
}

func ( *Decoder) ( byte) (uint32, error) {
	 := floatDigits[]
	switch  {
	case 0:
		// Check that next byte is not a digit.
		,  := .peek()
		if  == nil {
			switch floatDigits[] {
			case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "digit after leading zero")
			case dotInNumber, expInNumber, plusInNumber, minusInNumber:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "unexpected floating point character")
			case invalidCharForNumber:
				return 0, badToken(, .offset())
			}
		}
		return 0, nil // single zero
	default:
		if  < 0 {
			return 0, badToken(, .offset()-1)
		}
	}
	 := uint32()
	if .tail-.head > 9 {
		 := .head
		// Iteration 0.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+0)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+0)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1
			return , nil
		}
		++
		// Iteration 1.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+1)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+1)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10
			 += uint32() * 1
			return , nil
		}
		++
		// Iteration 2.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+2)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+2)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100
			 += uint32() * 10
			 += uint32() * 1
			return , nil
		}
		++
		// Iteration 3.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+3)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+3)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1000
			 += uint32() * 100
			 += uint32() * 10
			 += uint32() * 1
			return , nil
		}
		++
		// Iteration 4.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+4)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+4)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10000
			 += uint32() * 1000
			 += uint32() * 100
			 += uint32() * 10
			 += uint32() * 1
			return , nil
		}
		++
		// Iteration 5.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+5)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+5)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100000
			 += uint32() * 10000
			 += uint32() * 1000
			 += uint32() * 100
			 += uint32() * 10
			 += uint32() * 1
			return , nil
		}
		++
		// Iteration 6.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+6)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+6)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1000000
			 += uint32() * 100000
			 += uint32() * 10000
			 += uint32() * 1000
			 += uint32() * 100
			 += uint32() * 10
			 += uint32() * 1
			return , nil
		}
		++
		// Iteration 7.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+7)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+7)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10000000
			 += uint32() * 1000000
			 += uint32() * 100000
			 += uint32() * 10000
			 += uint32() * 1000
			 += uint32() * 100
			 += uint32() * 10
			 += uint32() * 1
			return , nil
		}
		++
		// Iteration 8.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+8)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+8)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100000000
			 += uint32() * 10000000
			 += uint32() * 1000000
			 += uint32() * 100000
			 += uint32() * 10000
			 += uint32() * 1000
			 += uint32() * 100
			 += uint32() * 10
			 += uint32() * 1
			return , nil
		}
		.head = 
		 *= 100000000
		 += uint32() * 10000000
		 += uint32() * 1000000
		 += uint32() * 100000
		 += uint32() * 10000
		 += uint32() * 1000
		 += uint32() * 100
		 += uint32() * 10
		 += uint32() * 1
	}
	for {
		 := .buf[.head:.tail]
		for ,  := range  {
			 = floatDigits[]
			switch  {
			case invalidCharForNumber:
				return 0, badToken(, .offset()+)
			case dotInNumber,
				expInNumber,
				plusInNumber,
				minusInNumber:
				 := badToken(, .offset()+)
				return 0, errors.Wrap(, "unexpected floating point character")
			case endOfNumber:
				.head += 
				return , nil
			}
			if  > uint32SafeToMultiple10 {
				 := ( << 3) + ( << 1) + uint32()
				if  <  {
					return 0, errOverflow
				}
				 = 
				continue
			}
			 = ( << 3) + ( << 1) + uint32()
		}
		switch  := .read();  {
		case io.EOF:
			return , nil
		case nil:
			continue
		default:
			return 0, 
		}
	}
}

// Int32 reads int32.
func ( *Decoder) () (int32, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	if  == '-' {
		,  := .byte()
		if  != nil {
			return 0, 
		}
		,  := .readUInt32()
		if  != nil {
			return 0, 
		}
		if  > math.MaxInt32+1 {
			return 0, errOverflow
		}
		return -int32(), nil
	}
	,  := .readUInt32()
	if  != nil {
		return 0, 
	}
	if  > math.MaxInt32 {
		return 0, errOverflow
	}
	return int32(), nil
}

// UInt64 reads uint64.
func ( *Decoder) () (uint64, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	return .readUInt64()
}

func ( *Decoder) ( byte) (uint64, error) {
	 := floatDigits[]
	switch  {
	case 0:
		// Check that next byte is not a digit.
		,  := .peek()
		if  == nil {
			switch floatDigits[] {
			case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "digit after leading zero")
			case dotInNumber, expInNumber, plusInNumber, minusInNumber:
				 := badToken(, .offset())
				return 0, errors.Wrap(, "unexpected floating point character")
			case invalidCharForNumber:
				return 0, badToken(, .offset())
			}
		}
		return 0, nil // single zero
	default:
		if  < 0 {
			return 0, badToken(, .offset()-1)
		}
	}
	 := uint64()
	if .tail-.head > 9 {
		 := .head
		// Iteration 0.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+0)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+0)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1
			return , nil
		}
		++
		// Iteration 1.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+1)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+1)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10
			 += uint64() * 1
			return , nil
		}
		++
		// Iteration 2.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+2)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+2)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100
			 += uint64() * 10
			 += uint64() * 1
			return , nil
		}
		++
		// Iteration 3.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+3)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+3)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1000
			 += uint64() * 100
			 += uint64() * 10
			 += uint64() * 1
			return , nil
		}
		++
		// Iteration 4.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+4)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+4)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10000
			 += uint64() * 1000
			 += uint64() * 100
			 += uint64() * 10
			 += uint64() * 1
			return , nil
		}
		++
		// Iteration 5.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+5)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+5)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100000
			 += uint64() * 10000
			 += uint64() * 1000
			 += uint64() * 100
			 += uint64() * 10
			 += uint64() * 1
			return , nil
		}
		++
		// Iteration 6.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+6)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+6)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 1000000
			 += uint64() * 100000
			 += uint64() * 10000
			 += uint64() * 1000
			 += uint64() * 100
			 += uint64() * 10
			 += uint64() * 1
			return , nil
		}
		++
		// Iteration 7.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+7)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+7)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 10000000
			 += uint64() * 1000000
			 += uint64() * 100000
			 += uint64() * 10000
			 += uint64() * 1000
			 += uint64() * 100
			 += uint64() * 10
			 += uint64() * 1
			return , nil
		}
		++
		// Iteration 8.
		 := floatDigits[.buf[]]
		switch  {
		case invalidCharForNumber:
			return 0, badToken(.buf[], .offset()+8)
		case dotInNumber,
			expInNumber,
			plusInNumber,
			minusInNumber:
			 := badToken(.buf[], .offset()+8)
			return 0, errors.Wrap(, "unexpected floating point character")
		case endOfNumber:
			.head = 
			 *= 100000000
			 += uint64() * 10000000
			 += uint64() * 1000000
			 += uint64() * 100000
			 += uint64() * 10000
			 += uint64() * 1000
			 += uint64() * 100
			 += uint64() * 10
			 += uint64() * 1
			return , nil
		}
		.head = 
		 *= 100000000
		 += uint64() * 10000000
		 += uint64() * 1000000
		 += uint64() * 100000
		 += uint64() * 10000
		 += uint64() * 1000
		 += uint64() * 100
		 += uint64() * 10
		 += uint64() * 1
	}
	for {
		 := .buf[.head:.tail]
		for ,  := range  {
			 = floatDigits[]
			switch  {
			case invalidCharForNumber:
				return 0, badToken(, .offset()+)
			case dotInNumber,
				expInNumber,
				plusInNumber,
				minusInNumber:
				 := badToken(, .offset()+)
				return 0, errors.Wrap(, "unexpected floating point character")
			case endOfNumber:
				.head += 
				return , nil
			}
			if  > uint64SafeToMultiple10 {
				 := ( << 3) + ( << 1) + uint64()
				if  <  {
					return 0, errOverflow
				}
				 = 
				continue
			}
			 = ( << 3) + ( << 1) + uint64()
		}
		switch  := .read();  {
		case io.EOF:
			return , nil
		case nil:
			continue
		default:
			return 0, 
		}
	}
}

// Int64 reads int64.
func ( *Decoder) () (int64, error) {
	,  := .more()
	if  != nil {
		return 0, 
	}
	if  == '-' {
		,  := .byte()
		if  != nil {
			return 0, 
		}
		,  := .readUInt64()
		if  != nil {
			return 0, 
		}
		if  > math.MaxInt64+1 {
			return 0, errOverflow
		}
		return -int64(), nil
	}
	,  := .readUInt64()
	if  != nil {
		return 0, 
	}
	if  > math.MaxInt64 {
		return 0, errOverflow
	}
	return int64(), nil
}