From 210f3d2b1555bae87c9de27ea145e16d3bddb0f8 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 3 Dec 2010 20:18:00 -0500 Subject: cleaning up previous commits. note that addition of new files under docs/source/lang/api and docs/source/lang/cpp which were just copies of files in docs/source/lang/ imply that change history is lost to git. --- source/lang/unsignedint.rst | 55 --------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 source/lang/unsignedint.rst (limited to 'source/lang/unsignedint.rst') diff --git a/source/lang/unsignedint.rst b/source/lang/unsignedint.rst deleted file mode 100644 index f6311da..0000000 --- a/source/lang/unsignedint.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. highlight:: cpp - -.. _lang-unsignedint: - -``unsigned int`` -================ - -An ``unsigned int`` (unsigned integer) is the same as an :ref:`int -` in that it stores a 4 byte integer value. However, -Instead of storing both negative and positive numbers, an ``unsigned -int`` can only store nonnegative values, yielding a range of 0 to -4,294,967,295 (the positive value is 2^32 - 1). - -The difference between an ``unsigned int`` and a (signed) ``int`` lies -in the way the highest bit, sometimes referred to as the "sign" bit, -is interpreted. In the case of the Maple ``int`` type (which is -signed), if the high bit is a "1", the number is interpreted as a -negative number, using a technique known as `two's complement math -`_. The -bits in an an ``unsigned int`` are interpreted according to the usual -rules for converting `binary to decimal -`_. - -An ``unsigned int`` is subject to the same :ref:`overflow issues -` as a regular ``int``; the only difference is -that an ``unsigned int`` will "underflow" at 0, and "overflow" at -4,294,967,295. Here is some example code which illustrates this:: - - unsigned int x; - x = 0; - x--; // x now contains 4,294,967,295; rolled over "left to right" - x++; // x now contains 0; rolled over "right to left" - -Here is an example of declaring an ``unsigned int`` variable named -``ledPin``, then giving it value 13:: - - unsigned int ledPin = 13; - -The general syntax for declaring an ``unsigned int`` variable named -``var``, then giving it value ``val``, looks like:: - - unsigned int var = val; - -See Also --------- - -- :ref:`int ` -- :ref:`char ` -- :ref:`unsigned char ` -- :ref:`long ` -- :ref:`unsigned long ` -- :ref:`Integer Constants ` -- :ref:`Variables ` - -.. include:: cc-attribution.txt -- cgit v1.2.3