Index: Utilities.c =================================================================== diff -u -r5fb988facecb08dceb2bba1c462d3097b53617f0 -rdbe0d08fe950a54ae97d311f92acdd5ad8090da4 --- Utilities.c (.../Utilities.c) (revision 5fb988facecb08dceb2bba1c462d3097b53617f0) +++ Utilities.c (.../Utilities.c) (revision dbe0d08fe950a54ae97d311f92acdd5ad8090da4) @@ -30,6 +30,10 @@ #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. @@ -248,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; } @@ -259,7 +263,7 @@ } } - nRem = ( 0x000F & ( nRem >> 12 ) ); + nRem = ( MASK_OFF_LOWEST_SIG_NIBBLE & ( nRem >> 12 ) ); return ( nRem ^ 0x00 ); }