move
This commit is contained in:
parent
b1d111d1bf
commit
583c797b40
1 changed files with 11 additions and 11 deletions
|
@ -533,6 +533,17 @@ proc getBit(state: var DecoderState): int =
|
|||
state.bitBuffer = state.bitBuffer shl 1
|
||||
dec state.bitsBuffered
|
||||
|
||||
proc getBits(state: var DecoderState, n: int): int =
|
||||
## Get n number of bits as a unsigned integer.
|
||||
if n notin 0 .. 16:
|
||||
failInvalid()
|
||||
if state.bitsBuffered < n:
|
||||
state.fillBitBuffer()
|
||||
let k = lrot(state.bitBuffer, n)
|
||||
state.bitBuffer = k and (not bitMasks[n])
|
||||
result = (k and bitMasks[n]).int
|
||||
state.bitsBuffered -= n
|
||||
|
||||
proc getBitsAsSignedInt(state: var DecoderState, n: int): int =
|
||||
## Get n number of bits as a signed integer.
|
||||
# TODO: Investigate why 15 not 16?
|
||||
|
@ -547,17 +558,6 @@ proc getBitsAsSignedInt(state: var DecoderState, n: int): int =
|
|||
state.bitsBuffered -= n
|
||||
result = k.int + (biases[n] and (not sign))
|
||||
|
||||
proc getBits(state: var DecoderState, n: int): int =
|
||||
## Get n number of bits as a unsigned integer.
|
||||
if n notin 0 .. 16:
|
||||
failInvalid()
|
||||
if state.bitsBuffered < n:
|
||||
state.fillBitBuffer()
|
||||
let k = lrot(state.bitBuffer, n)
|
||||
state.bitBuffer = k and (not bitMasks[n])
|
||||
result = (k and bitMasks[n]).int
|
||||
state.bitsBuffered -= n
|
||||
|
||||
proc decodeRegularBlock(
|
||||
state: var DecoderState, component: int, data: var array[64, int16]
|
||||
) =
|
||||
|
|
Loading…
Reference in a new issue