// ReadLE32 reads 32 bits of little-endian data from the RWops and returns in native format.
// (https://wiki.libsdl.org/SDL_ReadLE32)
173564
func (rwops *RWops) ReadLE32() uint32 {
	if rwops == nil {
		return 0
	}
	return uint32(C.SDL_ReadLE32(rwops.cptr()))
}
433927
func (r *Reader) ReadFloat32() float32 {
	tag := r.readByte()
	decoder := float32Decoders[tag]
	if decoder == nil {
		castError(tag, "float32")
	}
	return decoder(r)
}
333175
func (rwops *RWops) Read2(buf []byte, size, maxnum uint) (n int, err error) {
	if rwops == nil || buf == nil {
		return 0, ErrInvalidParameters
	}

	header := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
	_data := unsafe.Pointer(header.Data)

	n = int(C.RWread(rwops.cptr(), _data, C.size_t(size), C.size_t(maxnum)))
	if n == 0 {
		err = GetError()
	}
	return
}
354549
func (rwops *RWops) WriteLE16(value uint16) uint {
	if rwops == nil {
		return 0
	}
	return uint(C.SDL_WriteLE16(rwops.cptr(), C.Uint16(value)))
}
274660
func ReadAll(in io.Reader) ([]float32, *Format, error) {
	r, err := NewReader(in)
	if err != nil {
		return nil, nil, err
	}
	format := &Format{
		SampleRate: r.SampleRate(),
		Channels:   r.Channels(),
		Bitrate:    r.Bitrate(),
	}
	if r.Length() > 0 {
		result := make([]float32, (r.Length()-r.Position())*int64(r.Channels()))
		read := 0

		for {
			n, err := r.Read(result[read:])
			read += n
			if err != nil || read == len(result) {
				if err == io.EOF {
					err = nil
				}
				return result[:read], format, err
			}
			if n == 0 {
				return result[:read], format, io.ErrNoProgress
			}
		}
	}
	buf := make([]float32, r.dec.BufferSize())
	var result []float32
	for {
		n, err := r.Read(buf)
		result = append(result, buf[:n]...)
		if err != nil {
			if err == io.EOF {
				err = nil
			}
			return result, format, err
		}
		if n == 0 {
			return result, format, io.ErrNoProgress
		}
	}
}
745928
func uint32Bytes(i uint32) []byte {
	bytes := make([]byte, 4)
	binary.BigEndian.PutUint32(bytes, i)
	return bytes
}
700613
func (mcp *MCP23S17) ReadBit(bit_num uint, address byte) byte {
	value := mcp.Read(address)
	return (value >> bit_num) & 1
}
322166
func ReadVarUint32(r io.Reader) (uint32, error) {
	u64, err := ReadVarUint64(r)
	if err != nil {
		return 0, err
	}
	return uint32(u64), nil
}
141122
func (ed *eventData) writeUint32(value uint32) {
	binary.Write(&ed.buffer, binary.LittleEndian, value)
}
258962
func ConvertUint32(str string) (uint32, error) {
	i, err := strconv.ParseUint(str, 10, 32)
	if err != nil {
		return 0, err
	}
	return uint32(i), nil
}
490102
func ReadVarInt32(r io.Reader) (int32, error) {
	i64, err := ReadVarInt64(r)
	if err != nil {
		return 0, err
	}
	return int32(i64), nil
}
1339993
func StrInt32(v []byte, err error) (int32, error) {
	if err != nil {
		return 0, err
	} else if v == nil {
		return 0, nil
	} else {
		res, err := strconv.ParseInt(hack.String(v), 10, 32)
		return int32(res), err
	}
}
836849
func Uint32(b []byte) uint32 {
	if l := len(b); l != 4 {
		panic(fmt.Sprintf("Uint32: unexpected byte slice length: %d", l))
	}

	return *(*uint32)(unsafe.Pointer(&b[0]))
}
274859
func sliceBits32(x uint32, high, low uint8) uint32 {
	return (x << (31 - high)) >> (low + (31 - high))
}
758318
func (iter *Iterator) ReadFloat32() (ret float32) {
	c := iter.nextToken()
	if c == '-' {
		return -iter.readPositiveFloat32()
	}
	iter.unreadByte()
	return iter.readPositiveFloat32()
}
404519
func (bd *BinaryDecoder) ReadLong() (int64, error) {
	var value uint64
	var b uint8
	var offset int
	bufLen := int64(len(bd.buf))

	for {
		if offset == maxLongBufSize {
			return 0, LongOverflow
		}

		if bd.pos >= bufLen {
			return 0, InvalidLong
		}

		b = bd.buf[bd.pos]
		value |= uint64(b&0x7F) << uint(7*offset)
		bd.pos++
		offset++

		if b&0x80 == 0 {
			break
		}
	}
	return int64((value >> 1) ^ -(value & 1)), nil
}
577523
func WriteUint32(w io.Writer, value uint32) error {
	return binary.Write(w, binary.BigEndian, value)
}