// UintToHex trans uint32 to robotgo.CHex
5381
func UintToHex(u uint32) CHex {
	hex := U32ToHex(C.uint32_t(u))
	return CHex(hex)
}
1356270
func (f *Forms) Uint32(key string) (uint32, error) {
	v, err := strconv.ParseUint((*http.Request)(f).FormValue(key), 10, 32)
	return uint32(v), err
}
755311
func (p *parserMixin) Uint8() (target *uint8) {
	target = new(uint8)
	p.Uint8Var(target)
	return
}
1160714
func (a *Array) Uint32(i uint32) *Array {
	a.buf = enc.AppendUint32(enc.AppendArrayDelim(a.buf), i)
	return a
}
1215384
func (val XMValue) UInt32() (v uint32) {
	encoding.ReadFrom(bytes.NewBuffer(val), &v)
	return
}
26094
func NewDigestFromHex(alg, hex string) Digest {
	return Digest(fmt.Sprintf("%s:%s", alg, hex))
}
506018
func Uint32ToBytesTo(v uint32, ret []byte) {
	binary.BigEndian.PutUint32(ret, v)
}
586264
func (x *Big) Uint64() (uint64, bool) {
	if debug {
		x.validate()
	}

	if !x.IsFinite() || x.Signbit() {
		return 0, false
	}

	// x might be too large to fit into an uint64 *now*, but rescaling x might
	// shrink it enough. See issue #20.
	if !x.isCompact() {
		xb := x.Int(nil)
		return xb.Uint64(), xb.IsUint64()
	}

	b := x.compact
	if x.exp == 0 {
		return b, true
	}
	return scalex(b, x.exp)
}
101202
func BigToHex(bigInt big.Int) string {
	if bigInt.BitLen() == 0 {
		return "0x0"
	}

	return "0x" + strings.TrimPrefix(fmt.Sprintf("%x", bigInt.Bytes()), "0")
}
674999
func (e *Ethtool) ModuleEepromHex(intf string) (string, error) {
	eeprom, _, err := e.getModuleEeprom(intf)
	if err != nil {
		return "", err
	}

	return hex.EncodeToString(eeprom.data[:eeprom.len]), nil
}
776909
func parseHex(h []byte) (uint16, error) {
	var b [2]uint8
	n, err := hex.Decode(b[:], h)
	switch {
	case err != nil:
		return 0, err
	case n != 2:
		return 0, errors.New("short output")
	}
	return uint16(b[0])<<8 | uint16(b[1]), nil
}
1258517
func (e Encoder) AppendHex(dst []byte, val []byte) []byte {
	dst = append(dst, byte(majorTypeTags|additionalTypeIntUint16))
	dst = append(dst, byte(additionalTypeTagHexString>>8))
	dst = append(dst, byte(additionalTypeTagHexString&0xff))
	return e.AppendBytes(dst, val)
}
937242
func (a *Array) Hex(val []byte) *Array {
	a.buf = enc.AppendHex(enc.AppendArrayDelim(a.buf), val)
	return a
}
1167248
func RandomHex(count int) ([]byte, error) {
	raw := make([]byte, count)
	_, err := rand.Read(raw)
	if err != nil {
		log.Errorf("RandomBytes(): Error %s", err.Error())
		return nil, err
	}

	encoded := make([]byte, count*2)
	hex.Encode(encoded, raw)
	return encoded, nil
}
1252819
func (c Context) Uint32(key string, i uint32) Context {
	c.l.context = enc.AppendUint32(enc.AppendKey(c.l.context, key), i)
	return c
}
796356
func (e *Event) Uint32(key string, i uint32) *Event {
	if e == nil {
		return e
	}
	e.buf = enc.AppendUint32(enc.AppendKey(e.buf, key), i)
	return e
}
1141574
func HexToDec(hexMask string, base int) (int, bool) {
	var number int = 0
	var i int
	for i = base; i < len(hexMask); i++ {
		if '0' <= hexMask[i] && hexMask[i] <= '9' {
			number *= 16
			number += int(hexMask[i] - '0')
		} else if 'a' <= hexMask[i] && hexMask[i] <= 'f' {
			number *= 16
			number += int(hexMask[i]-'a') + 10
		} else if 'A' <= hexMask[i] && hexMask[i] <= 'F' {
			number *= 16
			number += int(hexMask[i]-'A') + 10
		} else {
			break
		}
		if number >= 0xFFFFFF {
			return 0, false
		}
	}
	if i == base {
		return 0, false
	}
	return number, true
}