// ReverseUint32N reverses the lower n bits of v.
550609
func ReverseUint32N(v uint32, n uint) (x uint32) {
	return ReverseUint32(v << (32 - n))
}
864483
func (l *Locking) Uint32() (v uint32) {
	l.Lock()
	v = l.R.Uint32()
	l.Unlock()
	return
}
322166
func ReadVarUint32(r io.Reader) (uint32, error) {
	u64, err := ReadVarUint64(r)
	if err != nil {
		return 0, err
	}
	return uint32(u64), nil
}
896257
func MaxUint8N(v ...uint8) uint8 {
	switch len(v) {
	case 0:
		return 0
	case 1:
		return v[0]
	case 2:
		return MaxUint8(v[0], v[1])
	default:
		l := len(v) / 2
		return MaxUint8N(MaxUint8N(v[:l]...), MaxUint8N(v[l:]...))
	}
}
86016
func (w *ByteWriter) MustWriteUint32(val uint32, offset int) int {
	return w.MustWriteVal(val, offset)
}
1127816
func MinInt32N(v ...int32) int32 {
	switch len(v) {
	case 0:
		return 0
	case 1:
		return v[0]
	case 2:
		return MinInt32(v[0], v[1])
	default:
		l := len(v) / 2
		return MinInt32N(MinInt32N(v[:l]...), MinInt32N(v[l:]...))
	}
}
1322780
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
}
223243
func MinUintN(v ...uint) uint {
	switch len(v) {
	case 0:
		return 0
	case 1:
		return v[0]
	case 2:
		return MinUint(v[0], v[1])
	default:
		l := len(v) / 2
		return MinUintN(MinUintN(v[:l]...), MinUintN(v[l:]...))
	}
}
87138
func ReverseBytes(x uint) uint {
	if UintSize == 32 {
		return uint(ReverseBytes32(uint32(x)))
	}
	return uint(ReverseBytes64(uint64(x)))
}
776220
func (lr *LockedRand) Uint32() (n uint32) {
	lr.lk.Lock()
	n = lr.r.Uint32()
	lr.lk.Unlock()
	return
}
629687
func (Encoder) AppendUint32(dst []byte, val uint32) []byte {
	return strconv.AppendUint(dst, uint64(val), 10)
}
892176
func ReverseBits(num uint) uint {
	var n uint
	size := uint(unsafe.Sizeof(num))
	for s := size * 8; s > 0; s-- {
		n = n << 1
		n |= (num & 1)
		num = num >> 1
	}

	return n
}
1295812
func (dec *Decoder) DecodeUint32(v *uint32) error {
	if dec.isPooled == 1 {
		panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder"))
	}
	return dec.decodeUint32(v)
}
1373116
func deinterleaveUint32(code uint64) (uint32, uint32) {
	x := (deinterleaveLookup[code&0x55]) |
		(deinterleaveLookup[(code>>8)&0x55] << 4) |
		(deinterleaveLookup[(code>>16)&0x55] << 8) |
		(deinterleaveLookup[(code>>24)&0x55] << 12) |
		(deinterleaveLookup[(code>>32)&0x55] << 16) |
		(deinterleaveLookup[(code>>40)&0x55] << 20) |
		(deinterleaveLookup[(code>>48)&0x55] << 24) |
		(deinterleaveLookup[(code>>56)&0x55] << 28)
	y := (deinterleaveLookup[code&0xaa]) |
		(deinterleaveLookup[(code>>8)&0xaa] << 4) |
		(deinterleaveLookup[(code>>16)&0xaa] << 8) |
		(deinterleaveLookup[(code>>24)&0xaa] << 12) |
		(deinterleaveLookup[(code>>32)&0xaa] << 16) |
		(deinterleaveLookup[(code>>40)&0xaa] << 20) |
		(deinterleaveLookup[(code>>48)&0xaa] << 24) |
		(deinterleaveLookup[(code>>56)&0xaa] << 28)
	return x, y
}
43801
func (r *reader) readVarUint32() uint32 {
	var x, s uint32
	for {
		b := uint32(r.readByte())
		x |= (b & 0x7F) << s
		s += 7
		if ((b & 0x80) == 0) || (s == 35) {
			break
		}
	}

	return x
}
1154872
func (d *Context) ToUint32(index int) uint32 {
	return uint32(C.duk_to_uint32(d.duk_context, C.duk_idx_t(index)))
}
228695
func ReverseU(a []uint32) []uint32 {
	for left, right := 0, len(a)-1; left < right; left, right = left+1, right-1 {
		a[left], a[right] = a[right], a[left]
	}

	return a
}