You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bit_reader.go
    path of file: ./repos/scan4all/vendor/github.com/nwaples/rardecode
    
    the code of the file until where you have to start completion: package rardecode

import "io"

type bitReader interface {
	readBits(n uint) (int, error) // read n bits of data
	unreadBits(n uint)            // revert the reading of the last n bits read
}

type limitedBitReader struct {
	br  bit
    
func (r *rarBitReader) readUint32() (uint32, error) {
	n, err := r.readBits(2)
	if err != nil {
		return 0, err
	}
	if n != 1 {
		n, err = r.readBits(4 << uint(n))
		return uint32(n), err
	}
	n, err = r.readBits(4)
	if err != nil {
		return 0, err
	}
	if n == 0 {
		n, err = r.readBits(8)
		n |= -1 << 8
		return uint32(n), err
	}
	nlow, err := r.readBits(4)
	n = n<<4 | nlow
	return uint32(n), err
}