2023-01-21 15:34:25 +01:00
|
|
|
(* ****************************************
|
|
|
|
Дополнение к модулю Math.
|
|
|
|
Побитовые операции над целыми числами.
|
|
|
|
Вадим Исаев, 2020
|
|
|
|
Additional functions to the module Math.
|
|
|
|
Bitwise operations on integers.
|
|
|
|
Vadim Isaev, 2020
|
|
|
|
******************************************* *)
|
|
|
|
|
|
|
|
MODULE MathBits;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE iand* (x, y: INTEGER): INTEGER;
|
|
|
|
RETURN ORD(BITS(x) * BITS(y))
|
|
|
|
END iand;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE ior* (x, y: INTEGER): INTEGER;
|
|
|
|
RETURN ORD(BITS(x) + BITS(y))
|
|
|
|
END ior;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE ixor* (x, y: INTEGER): INTEGER;
|
|
|
|
RETURN ORD(BITS(x) / BITS(y))
|
|
|
|
END ixor;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE inot* (x: INTEGER): INTEGER;
|
|
|
|
RETURN ORD(-BITS(x))
|
|
|
|
END inot;
|
|
|
|
|
|
|
|
|
|
|
|
END MathBits.
|