LINEAR11 Conversion Using a Sign Extension Bit Twiddling Hack

The LINEAR11 data format is used by PMBus (Power Management Bus) devices. LINEAR11 is a 16-bit number which is composed of a pair of two’s complement signed integers. When I was faced with converting from LINEAR11 to floating-point, I ended up running into sign extension problems. Luckily, I stumbled upon a simple trick that we can use …