aboutsummaryrefslogtreecommitdiffstats
path: root/source/arduino/bitwisexornot.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-10-25 21:15:28 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-11-17 12:44:28 -0500
commit2d429e75ce69e77f8c95490ac03881ec9aa0354a (patch)
treea3b810a6c75625b07a4b976e5d1e319c60e19a6b /source/arduino/bitwisexornot.rst
parent30ac55d80c18e93f9c39a6dd850c10f9e7fd92ac (diff)
downloadlibrambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.tar.gz
librambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.zip
arduino language reference nearing completion, properly CC-BY-SA 3.0 attributed
Diffstat (limited to 'source/arduino/bitwisexornot.rst')
-rw-r--r--source/arduino/bitwisexornot.rst51
1 files changed, 0 insertions, 51 deletions
diff --git a/source/arduino/bitwisexornot.rst b/source/arduino/bitwisexornot.rst
deleted file mode 100644
index 25389cb..0000000
--- a/source/arduino/bitwisexornot.rst
+++ /dev/null
@@ -1,51 +0,0 @@
-.. _arduino-bitwisexornot:
-
-Bitwise NOT (~)
-===============
-
-The bitwise NOT operator in C++ is the tilde character ~. Unlike &
-and \|, the bitwise NOT operator is applied to a single operand to
-its right. Bitwise NOT changes each bit to its opposite: 0 becomes
-1, and 1 becomes 0. For example:
-
-
-
-::
-
- 0 1 operand1
-
-
-
-::
-
- ----------
- 1 0 ~ operand1
-
-
-
-::
-
- int a = 103; // binary: 0000000001100111
- int b = ~a; // binary: 1111111110011000 = -104
-
-
-
-You might be surprised to see a negative number like -104 as the
-result of this operation. This is because the highest bit in an int
-variable is the so-called sign bit. If the highest bit is 1, the
-number is interpreted as negative. This encoding of positive and
-negative numbers is referred to as two's complement. For more
-information, see the Wikipedia article on
-`two's complement. <http://en.wikipedia.org/wiki/Twos_complement>`_
-
-
-
-As an aside, it is interesting to note that for any integer x, ~x
-is the same as -x-1.
-
-
-
-At times, the sign bit in a signed integer expression can cause
-some unwanted surprises.
-
-