1 #include <fridh/symbol.hpp>
5 #define BINARY_OPERATOR(name, description, operator) \
6 void variable::name(variable const & argument, variable & output) const \
8 if(is_integer_type() && argument.is_integer_type()) \
9 output.new_unsigned_integer(unsigned_integer operator argument.unsigned_integer); \
11 binary_argument_type_error(description, type, argument.type); \
14 BINARY_OPERATOR(shift_left
, "Shift left", <<)
15 BINARY_OPERATOR(shift_right
, "Shift right", >>)
16 BINARY_OPERATOR(binary_and
, "Binary and", &)
17 BINARY_OPERATOR(binary_or
, "Binary or", |)
18 BINARY_OPERATOR(binary_xor
, "Binary exclusive or", ^)
20 void variable::binary_not(variable
& output
) const
23 output
.new_unsigned_integer(~unsigned_integer
);
25 unary_argument_type_error("Binary not", type
);