MathBits.ob07 718 B

123456789101112131415161718192021222324252627282930313233
  1. (* ****************************************
  2. Дополнение к модулю Math.
  3. Побитовые операции над целыми числами.
  4. Вадим Исаев, 2020
  5. Additional functions to the module Math.
  6. Bitwise operations on integers.
  7. Vadim Isaev, 2020
  8. ******************************************* *)
  9. MODULE MathBits;
  10. PROCEDURE iand* (x, y: INTEGER): INTEGER;
  11. RETURN ORD(BITS(x) * BITS(y))
  12. END iand;
  13. PROCEDURE ior* (x, y: INTEGER): INTEGER;
  14. RETURN ORD(BITS(x) + BITS(y))
  15. END ior;
  16. PROCEDURE ixor* (x, y: INTEGER): INTEGER;
  17. RETURN ORD(BITS(x) / BITS(y))
  18. END ixor;
  19. PROCEDURE inot* (x: INTEGER): INTEGER;
  20. RETURN ORD(-BITS(x))
  21. END inot;
  22. END MathBits.