C << /
#define COMPAT_VERSION_MAJOR 3
#define COMPAT_VERSION_MINOR 2 #define COMPAT_VERSION ((COMPAT_VERSION_MINOR << 8) \ | COMPAT_VERSION_MAJOR) Plz explain what << 8 and \ mean ? |
Re: C << /
Quote:
"x << 8" means: "take x, and shift its bits 8 bit-positions to the left. (8 bits == 1 byte). So "x << 8" is equivalent to multiplying by 256. Likewise "6 << 1" evaluates to 12 (the bits of 6 == 00000110 are shifted one bit-position to the left: 00001100, which is 12). Example: Say x == 254(decinal) == FE(hexadecimal) == 11111110(bin). Then (x << 8) will be: 1111111000000000(bin) == FE00(hex) == 65024(dec). Th \ just "escapes" the newline following it, so the compiler will consider the two lines as one. Example: printf("hello \ there"); will be processed by the compiler as if it were: printf("hello there"); |
All times are GMT -5. The time now is 06:25 PM. |