>Using logical operators and two 8 bit words, which cannot ever produce >a non char result doesn't trigger the action. > >Russell The C standard requires integer promotion even with logical values, however the "AS IF" rule saves you in most cases, although the proper handling of something like foo|~bar can result in an extended (16-bit) value. The "AS IF" rule can allow a compiler to avoid promotion even for addition and subtraction. For example, given: unsigned char a,b,c; a = b + c; The compiler does not need to promote to integer because the resulting value in "a" wouldn't change if it did. However, the OP's case: unsigned char a,b,c; if (a == b + c) .... appears to require promotion because the result could overflow. However, because "b + c" is at most 9 bits wide, a (very?) smart compiler or a sharp assembly coder could avoid 16-bit arithmetic by handling it something like: (for PIC16F) MOVF _b,W ADDWF _c,W ; sets carry if B+C > 0xFF XORWF _a,W ; sets Z if A == low (B+C), carry unchanged BTFSS STATUS,C ; skip to unequal case if C set BTFSS STATUS,Z ; skip to equal case if Z set GOTO UNEQUAL ; come here if C set or Z clear UNEQUAL: (or, more simply and 1 less instruction, for PIC18F) MOVF _b,W ADDWF _c,W ; sets carry if B+C > 0xFF BC UNEQUAL XORWF _a,W BNZ UNEQUAL UNEQUAL: (or, to leave the comparison result in the "Z" flag): MOVF _b,W ADDWF _c,W ; sets carry if B+C > 0xFF XORWF _a,W ; sets Z if A == low(B+C), carry unchanged BTFSC STATUS,C ; if carry is set BCF STATUS,Z ;...then clear Z flag -- Bob Ammerman RAm Systems -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist