// Len32 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
188713
func Len32(x uint32) (n int) {
	if x >= 1<<16 {
		x >>= 16
		n = 16
	}
	if x >= 1<<8 {
		x >>= 8
		n += 8
	}
	return n + int(len8tab[x])
}
1106545
func Float32(val string) (float32, error) {
	f, err := strconv.ParseFloat(val, 32)
	if err != nil {
		return 0, err
	}
	return float32(f), nil
}
797728
func CountLeadZero32(value uint32) (uint) {
    var count uint = 0

    if (value & 0xFFFF0000) == 0 {
        count += 16;
        value <<= 16;
    }
    if (value & 0xFF000000) == 0 {
        count += 8;
        value <<= 8;
    }
    if (value & 0xF0000000) == 0 {
        count += 4;
        value <<= 4;
    }
    if (value & 0x30000000) == 0 {
        count += 2;
        value <<= 2;
    }
    if (value & 0x10000000) == 0 {
        count++;
        value <<= 1;
    }
    if (value & 0x10000000) == 0 {
        count++;
    }

    return count
}
215492
func AsInt32(x Value) (int, error) {
	i, ok := x.(Int)
	if !ok {
		return 0, fmt.Errorf("got %s, want int", x.Type())
	}
	if i.bigint.BitLen() <= 32 {
		v := i.bigint.Int64()
		if v >= math.MinInt32 && v <= math.MaxInt32 {
			return int(v), nil
		}
	}
	return 0, fmt.Errorf("%s out of range", i)
}
789638
func (l *List) Len() int {
	if l == nil { // not initialized yet?
		return 0
	}

	return int(atomic.LoadUintptr(&l.count))
}
75178
func MinUint32N(v ...uint32) uint32 {
	switch len(v) {
	case 0:
		return 0
	case 1:
		return v[0]
	case 2:
		return MinUint32(v[0], v[1])
	default:
		l := len(v) / 2
		return MinUint32N(MinUint32N(v[:l]...), MinUint32N(v[l:]...))
	}
}
1179719
func varint32(value int) []byte {
	buf := make([]byte, binary.MaxVarintLen32)
	n := binary.PutUvarint(buf, uint64(value))
	return buf[:n]
}
1237796
func Int32toInt24LEBytes(n int32) []byte {
	bytes := make([]byte, 3)
	if (n & 0x800000) > 0 {
		n |= ^0xffffff
	}
	bytes[2] = byte(n >> 16)
	bytes[1] = byte(n >> 8)
	bytes[0] = byte(n >> 0)
	return bytes
}
1232846
func Len64(x uint64) (n int) {
	if x >= 1<<32 {
		x >>= 32
		n = 32
	}
	if x >= 1<<16 {
		x >>= 16
		n += 16
	}
	if x >= 1<<8 {
		x >>= 8
		n += 8
	}
	return n + int(len8tab[x])
}
1096459
func (enc *Encoder) WriteInt32(val int32) error {
	return enc.WriteInt(int(val))
}
1036679
func Len(x uint) int {
	if UintSize == 32 {
		return Len32(uint32(x))
	}
	return Len64(uint64(x))
}
477082
func (w *ByteWriter) WriteUint32(val uint32, offset int) (int, error) {
	return w.WriteVal(val, offset)
}
73489
func (v *Value) Len() int {
	switch v.getResolvedValue().Kind() {
	case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
		return v.getResolvedValue().Len()
	case reflect.String:
		runes := []rune(v.getResolvedValue().String())
		return len(runes)
	default:
		logf("Value.Len() not available for type: %s\n", v.getResolvedValue().Kind().String())
		return 0
	}
}
212478
func Len16(x uint16) (n int) {
	if x >= 1<<8 {
		x >>= 8
		n = 8
	}
	return n + int(len8tab[x])
}
745928
func uint32Bytes(i uint32) []byte {
	bytes := make([]byte, 4)
	binary.BigEndian.PutUint32(bytes, i)
	return bytes
}
267742
func Uint32s(b0, b1 []uint32) int {
	d := 0
	for i, x := range b0 {
		d += Uint32(x, b1[i])
	}
	return d
}
1268753
func Int32(b []byte) int32 {
	if l := len(b); l != 4 {
		panic(fmt.Sprintf("Int32: unexpected byte slice length: %d", l))
	}

	return *(*int32)(unsafe.Pointer(&b[0]))
}