return false;
}
+ static bool bitOr(Integral A, Integral B, unsigned OpBits, Integral *R) {
+ *R = Integral(A.V | B.V);
+ return false;
+ }
+
static bool neg(Integral A, Integral *R) {
*R = -A;
return false;
/// 1) Pops the RHS from the stack.
/// 2) Pops the LHS from the stack.
+/// 3) Pushes 'LHS | RHS' on the stack
+template <PrimType Name, class T = typename PrimConv<Name>::T>
+bool BitOr(InterpState &S, CodePtr OpPC) {
+ const T &RHS = S.Stk.pop<T>();
+ const T &LHS = S.Stk.pop<T>();
+
+ unsigned Bits = RHS.bitWidth();
+ T Result;
+ if (!T::bitOr(LHS, RHS, Bits, &Result)) {
+ S.Stk.push<T>(Result);
+ return true;
+ }
+ return false;
+}
+
+/// 1) Pops the RHS from the stack.
+/// 2) Pops the LHS from the stack.
/// 3) Pushes 'LHS % RHS' on the stack (the remainder of dividing LHS by RHS).
template <PrimType Name, class T = typename PrimConv<Name>::T>
bool Rem(InterpState &S, CodePtr OpPC) {
static_assert((1337 & -1) == 1337, "");
static_assert((0 & gimme(12)) == 0, "");
};
+
+namespace bitOr {
+ static_assert((10 | 1) == 11, "");
+ static_assert((10 | 10) == 10, "");
+
+ static_assert((1337 | -1) == -1, "");
+ static_assert((0 | gimme(12)) == 12, "");
+ static_assert((12 | true) == 13, "");
+};