Converting Int32 to 24-bit signed integer
-
29-10-2019 - |
Question
I have a need to convert an Int32 value to a 3-byte (24-bit) integer. Endianness remains the same (little), but I cannot figure out how to move the sign appropriately. The values are already constrained to the proper range, I just can't figure out how to convert 4 bytes to 3. Using C# 4.0. This is for hardware integration, so I have to have 24-bit values, cannot use 32 bit.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow