Ejemplo n.º 1
0
void SRExpressionsParser::bitwiseOr(double* r)
{
	double t = 0;
	char o;

	bitwiseXor(r);
	while((o = *(token.value())) == '|')
	{
		parse();
		bitwiseXor(&t);
		if(o == '|')
			*r = (int)*r | (int)t;
	}
}
Ejemplo n.º 2
0
/**
 * Evaluates a bitwise or expression (a | b) by recursively calling the
 * functions for evaluating expressions with higher precedence.
 *
 * @param[out] ret: the integer value the bitwise or expression evaluates to
 *
 * @return: whether at the current location the expression can be evaluated
 */
bool
MacroParser::bitwiseOr(int64_t *ret)
{
	int64_t term2 = 0;
	if (bitwiseXor(ret)) {
		for (;;) {
			if (_scanner.atSymbol(OR)) {
				if (bitwiseXor(&term2)) {
					*ret = *ret | term2;
				} else {
					return false;
				}
			} else {
				return true;
			}
		}
	}
	return false;
}