diff options
| author | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-06-27 11:17:34 +0200 |
|---|---|---|
| committer | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-06-27 11:17:34 +0200 |
| commit | 9e625b89bac7e8daaf583e215f3a0df3dc250bb2 (patch) | |
| tree | ab295455fce73f726bd97a325a61d95aca77a508 /sonstiges/bitOps.cpp | |
| parent | 5bb1ac05882e0df43a2afe0c363e0f503f51c357 (diff) | |
Math section rebuild, merged convinience and sonstiges section.
Diffstat (limited to 'sonstiges/bitOps.cpp')
| -rw-r--r-- | sonstiges/bitOps.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sonstiges/bitOps.cpp b/sonstiges/bitOps.cpp index b882965..b75304f 100644 --- a/sonstiges/bitOps.cpp +++ b/sonstiges/bitOps.cpp @@ -1,15 +1,14 @@ -//lsb: 0-th bit, msb: n-th bit -//get j-th bit +// Bit an Position j auslesen. (a & (1 << j)) != 0 -//set j-th bit +// Bit an Position j setzen. a |= (1 << j) -//clear j-th bit +// Bit an Position j löschen. a &= ~(1 << j) -//toggle j-th bit +// Bit an Position j umkehren. a ^= (1 << j) -//get value of least significant bit set +// Wert des niedrigsten gesetzten Bits. (a & -a) -//turn on all bits +// Setzt alle Bits auf 1. a = -1 -//turn on first n bits (be aware of overflows) +// Setzt die ersten n Bits auf 1. Achtung: Overflows. a = (1 << n) - 1 |
