I have a bitstring:
<<3, 0, 0, 0>>
that i’m trying to split into two values like so:
<<chunk::little-unsigned-size(31), is_first_chunk::little-unsigned-size(1)>> = <<3, 0, 0, 0>>
following this specification:
chunk/isFirstChunk (upper 31bits/lowest bit)
“chunk” and “isFirstChunk” are combined into an unsigned 32bit value. Therefore it will be encoded as
uint32_t chunkX
and extracted as
chunk = chunkX >> 1 isFirstChunk = chunkX & 0x1
and I’m expecting both values to be 1
but it’s actually 3
and 0
respectively.
Am I wrong?