-#define SET_BITS(_startBit, _numBits, _byte) \
-{ \
- _byte = (((~((~0)<<_numBits))<<_startBit)); \
+#define SET_BITS_MSB(_startBit, _numBits, _byte) \
+{ \
+ _byte = (~((0xFF) >> _numBits)); \
+ _byte >>= _startBit; \
+}
+
+#define SET_BITS_LSB(_startBit, _numBits, _byte) \
+{ \
+ _byte = (~((0xFF) << _numBits)); \
+ _byte <<= _startBit; \