bitstruct icon indicating copy to clipboard operation
bitstruct copied to clipboard

Packing data across byte boundaries

Open FirebarSim opened this issue 4 months ago • 0 comments

Hi, thanks for an awesome tool. I have been using it really happily with a lot of data that is mostly multiples of 8 bits or sets of bools and enums. However I have hit a new challenge with a specific message type to encode. It packs like the below and I have struggled to work out if there is a corresponding format string.

a = message_id: 6 bit uint
b = repeat_count: 2 bit uint
c = sender: 30 bit uint
d = status: 4 bit uint
e ... etc

it continues on with other values, including a 27 and a 28 bit signed integer. The packed fields should come out like this:

b1 b0 a6 a a a a a0 | c7 c c c c c c c0 | c14 c c c c c c c8 | c23 c c c c c c c9 | d1 d0 c29 c c c c c24 |  e5 e e e e e0 d3 d2 | ...

Figured it was a worth a shot asking what to try next

FirebarSim avatar Oct 14 '24 16:10 FirebarSim