NeatMonster/Octogon

OR'ing multiple signed values

mumbel opened this issue · 0 comments

For example:

[s16 = (s16_27_21 << 0) | (s16_13_5 << 7);] {

Only the most significant piece should be signed as the sign in any non-most significant will saturate the high bits if their signed bit is set.

If s16_27_21=0b1000000 and s16_13_5=0b000000000, the 16-bit result would be 0xffc0 because bit 27 saturated leading bits. Whereas you would probably expect it to be 0x0040