// Copyright 2018 Klaus Post. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Based on work Copyright (c) 2013, Yann Collet, released under BSD License.

package fse

// byteReader provides a byte reader that reads
// little endian values from a byte stream.
// The input stream is manually advanced.
// The reader performs no bounds checks.
type byteReader struct {
	b   []byte
	off int
}

// init will initialize the reader and set the input.
func ( *byteReader) ( []byte) {
	.b = 
	.off = 0
}

// advance the stream b n bytes.
func ( *byteReader) ( uint) {
	.off += int()
}

// Uint32 returns a little endian uint32 starting at current offset.
func ( byteReader) () uint32 {
	 := .b[.off:]
	 = [:4]
	 := uint32([3])
	 := uint32([2])
	 := uint32([1])
	 := uint32([0])
	return  | ( << 8) | ( << 16) | ( << 24)
}

// unread returns the unread portion of the input.
func ( byteReader) () []byte {
	return .b[.off:]
}

// remain will return the number of bytes remaining.
func ( byteReader) () int {
	return len(.b) - .off
}