From 442921c7bd93e9e111845de6c22f66753b41e11a Mon Sep 17 00:00:00 2001 From: Paul Jungeblut Date: Thu, 6 Oct 2016 00:17:59 +0200 Subject: Renamin sonstiges ot other. --- other/bitOps.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 other/bitOps.cpp (limited to 'other/bitOps.cpp') diff --git a/other/bitOps.cpp b/other/bitOps.cpp new file mode 100644 index 0000000..b75304f --- /dev/null +++ b/other/bitOps.cpp @@ -0,0 +1,14 @@ +// Bit an Position j auslesen. +(a & (1 << j)) != 0 +// Bit an Position j setzen. +a |= (1 << j) +// Bit an Position j löschen. +a &= ~(1 << j) +// Bit an Position j umkehren. +a ^= (1 << j) +// Wert des niedrigsten gesetzten Bits. +(a & -a) +// Setzt alle Bits auf 1. +a = -1 +// Setzt die ersten n Bits auf 1. Achtung: Overflows. +a = (1 << n) - 1 -- cgit v1.2.3