// Uint32Bytes encodes a uint32 into a newly-allocated byte slice using the
// host machine's native endianness.  It is a shortcut for allocating a new
// byte slice and filling it using PutUint32.
557622
func Uint32Bytes(v uint32) []byte {
	b := make([]byte, 4)
	PutUint32(b, v)
	return b
}
21241
func bytesToUint32(s []byte) uint32 {
	n := uint32(0)
	p := uint32(1)
	for i := range s {
		n += uint32(s[len(s)-1-i]-'0') * p
		p *= 10
	}
	return n
}
529913
func (r *Encoder) EncodeInt32(x int32) error {
	_, err := r.w.Write([]byte{CHR_INT4})
	if err != nil {
		return err
	}
	return binary.Write(r.w, binary.BigEndian, x)
}
638356
func Uint16Bytes(v uint16) []byte {
	b := make([]byte, 2)
	PutUint16(b, v)
	return b
}
818404
func UInt16ToBytes(v uint16) []byte {
	ret := make([]byte, 2)
	Uint16ToBytesTo(v, ret)
	return ret
}
453447
func ReadUint32(r io.Reader) (uint32, error) {
	var v uint32
	if err := binary.Read(r, binary.BigEndian, &v); err != nil {
		return 0, err
	}

	return v, nil
}
759442
func UInt32ToBytes(v uint32) []byte {
	ret := make([]byte, 4)
	Uint32ToBytesTo(v, ret)
	return ret
}
1252819
func (c Context) Uint32(key string, i uint32) Context {
	c.l.context = enc.AppendUint32(enc.AppendKey(c.l.context, key), i)
	return c
}
614127
func uint64ToBytes(u uint64) []byte {
	buf := make([]byte, 8)
	binary.BigEndian.PutUint64(buf, u)
	return buf
}
267742
func Uint32s(b0, b1 []uint32) int {
	d := 0
	for i, x := range b0 {
		d += Uint32(x, b1[i])
	}
	return d
}
577523
func WriteUint32(w io.Writer, value uint32) error {
	return binary.Write(w, binary.BigEndian, value)
}
1215384
func (val XMValue) UInt32() (v uint32) {
	encoding.ReadFrom(bytes.NewBuffer(val), &v)
	return
}
87138
func ReverseBytes(x uint) uint {
	if UintSize == 32 {
		return uint(ReverseBytes32(uint32(x)))
	}
	return uint(ReverseBytes64(uint64(x)))
}
686569
func (stream *Stream) WriteUint32(val uint32) {
	q1 := val / 1000
	if q1 == 0 {
		stream.buf = writeFirstBuf(stream.buf, digits[val])
		return
	}
	r1 := val - q1*1000
	q2 := q1 / 1000
	if q2 == 0 {
		stream.buf = writeFirstBuf(stream.buf, digits[q1])
		stream.buf = writeBuf(stream.buf, digits[r1])
		return
	}
	r2 := q1 - q2*1000
	q3 := q2 / 1000
	if q3 == 0 {
		stream.buf = writeFirstBuf(stream.buf, digits[q2])
	} else {
		r3 := q2 - q3*1000
		stream.buf = append(stream.buf, byte(q3+'0'))
		stream.buf = writeBuf(stream.buf, digits[r3])
	}
	stream.buf = writeBuf(stream.buf, digits[r2])
	stream.buf = writeBuf(stream.buf, digits[r1])
}
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]))
}
1007444
func ReverseBytes32(x uint32) uint32 {
	const m = 1<<32 - 1
	x = x>>8&(m3&m) | x&(m3&m)<<8
	return x>>16 | x<<16
}
97443
func (c *cookies) Uint32(key string) (uint32, error) {
	ck, err := c.req.Cookie(key)
	if err != nil {
		return 0, err
	}
	v, err := strconv.ParseUint(ck.Value, 10, 32)
	return uint32(v), err
}