Index: Utilities.c =================================================================== diff -u -r2801d97e877dd78189aa891e80a2f7cf60a6a2b7 -rdbe0d08fe950a54ae97d311f92acdd5ad8090da4 --- Utilities.c (.../Utilities.c) (revision 2801d97e877dd78189aa891e80a2f7cf60a6a2b7) +++ Utilities.c (.../Utilities.c) (revision dbe0d08fe950a54ae97d311f92acdd5ad8090da4) @@ -31,6 +31,9 @@ #define INITIAL_CRC16_VAL 0xFFFF ///< Seed for 16-bit CRC function. #define INITIAL_CRC08_VAL 0x00 ///< Seed for 8-bit CRC function. +#define MASK_OFF_LOWEST_SIG_NIBBLE 0x000F ///< Bit mask to mask off the lowest significant nibble of an unsigned short. +#define MASK_OFF_MOST_SIG_BIT 0x8000 ///< Bit mask to mask off the most significant bit of an unsigned short. + #define HEX_LETTER_TO_NUMBER_CONV 0x37 ///< Hex letter (i.e. A) to number conversion. #define STR_TO_HEX_CONV_MAX_BYTES 8 ///< String to hex conversion maximum allowed bytes. @@ -249,7 +252,7 @@ for ( nBit = SHIFT_8_BITS_FOR_BYTE_SHIFT; nBit > 0; nBit-- ) { - if ( nRem & 0x8000 ) + if ( nRem & MASK_OFF_MOST_SIG_BIT ) { nRem = ( nRem << 1 ) ^ 0x3000; } @@ -260,7 +263,7 @@ } } - nRem = ( 0x000F & ( nRem >> 12 ) ); + nRem = ( MASK_OFF_LOWEST_SIG_NIBBLE & ( nRem >> 12 ) ); return ( nRem ^ 0x00 ); }