Hello everyone,

I have defined a MACRO as follows:

Code:

#define GET_BITS(bits, num_bits, bit)\
if(num_bits > 0)\
{\
GET_BIT(bit);\ /* Gets one bit from a string of Bytes*/
bits = bits | bit;\
while(0 < (num_bits-1))\
{\
bits = bits << 1;\
GET_BIT(bit);\
bits = bits | bit;\
num_bits--;\
}\
}

usage:

Code:

int var=0;
XsGET_BITS(var, 3, 0);

my C Compiler had no problem compiling just the macro definition. However when I try to use this macro in one of my functions I get a compiler error that states the following.

"Invalid lvalue in assignment"

Can anyone point me in the right direction???

Thanks!