void SRExpressionsParser::bitwiseXor(double* r) { double t = 0; char o; bitwiseAnd(r); while((o = *(token.value())) == '~') { parse(); bitwiseAnd(&t); if(o == '~') *r = (int)*r && (int)t; } }
/** * Evaluates a bitwise xor expression (a ^ b) by recursively calling the * functions for evaluating expressions with higher precedence. * * @param[out] ret: the integer value the bitwise xor expression evaluates to * * @return: whether at the current location the expression can be evaluated */ bool MacroParser::bitwiseXor(int64_t *ret) { int64_t term2 = 0; if (bitwiseAnd(ret)) { for (;;) { if (_scanner.atSymbol(XOR)) { if (bitwiseAnd(&term2)) { *ret = *ret ^ term2; } else { return false; } } else { return true; } } } return false; }
int main () { int a=10, b=20; printf("a = %d\n", a); printf("b = %d\n", b); if (a==5 && b++) printf(""); printf("a = %d\n", a); printf("b = %d\n", b); bitwiseAnd(); // bitwiseMasking(); bitwiseShift(); }