bit bitVal; unsigned char byteVal; : : bitVal = byteVal;
bitVal = byteVal & 0x01 // Equivalent to A or bitVal = (byteVal > 0) // Equivalent to B
Some cross-compilers handle it differently, and for that reason, I have always performed the byte-to-integer-bit and byte-to-boolean-bit conversions explicitly to handle either case. For example HI-TECH PICC (obviously for Microchip PIC microcontrollers) abides by a more ANSI-like interpretation, remaining faithful to C's integer conversion (narrowing) rules, and implements it like Andrew's example A. If I had ever thought about how bytes *should* be converted to bits, this is the way a "language lawyer" would probably have specified it (i.e., ANSI-like). Regards, --Dan Henry