C++ `unsigned`

types (`unsigned char`

, `unsigned short`

,
`unsigned int`

, and `unsigned long`

) represent unsigned
integers with the same number of bits as their corresponding
`signed`

integer.

% @(#)$Id: unsigned.lsl,v 1.5 1995/07/26 21:16:23 leavens Exp $ unsigned: trait includes unsignedChar, unsignedShort, unsignedInt, unsignedLong introduces to_unsignedShort: unsignedChar -> unsignedShort to_unsignedInt: unsignedShort -> unsignedInt to_unsignedLong: unsignedInt -> unsignedLong asserts \forall c: unsignedChar, s: unsignedShort, i: unsignedInt to_unsignedShort(0) == 0; to_unsignedShort(succ(c)) == succ(to_unsignedShort(c)); to_unsignedInt(0) == 0; to_unsignedInt(succ(s)) == succ(to_unsignedInt(s)); to_unsignedLong(0) == 0; to_unsignedLong(succ(i)) == succ(to_unsignedLong(i)); to_unsignedShort(UCHAR_MAX) <= USHRT_MAX; to_unsignedInt(USHRT_MAX) <= UINT_MAX; to_unsignedLong(UINT_MAX) <= ULONG_MAX

The following traits specify the abstract values of
the types `unsigned char`

,
`unsigned short`

, `unsigned int`

, and `unsigned long`

.
The included trait `IntCycle(first,last,N)`

found in the LSL Handbook,
defines a finite subrange of integers from `first`

to `last`

.
The subrange includes `0`

and wraps at `succ(last)`

, thus it
obeys the laws of arithmetic modulo `last`

.

% @(#)$Id: unsignedShort.lsl,v 1.4 1994/05/24 21:27:53 leavens Exp $ unsignedShort: trait includes IntCycle(0, USHRT_MAX, unsignedShort), NoContainedObjects(unsignedShort) % @(#)$Id: unsignedChar.lsl,v 1.4 1994/05/24 21:27:53 leavens Exp $ unsignedChar: trait includes IntCycle(0, UCHAR_MAX, unsignedChar), NoContainedObjects(unsignedChar) % @(#)$Id: unsignedInt.lsl,v 1.4 1994/05/24 21:27:53 leavens Exp $ unsignedInt: trait includes IntCycle(0, UINT_MAX, unsignedInt), NoContainedObjects(unsignedInt) % @(#)$Id: unsignedLong.lsl,v 1.4 1994/05/24 21:27:53 leavens Exp $ unsignedLong: trait includes IntCycle(0, ULONG_MAX, unsignedLong), NoContainedObjects(unsignedLong)

A C++ `unsigned`

integer constant, an integer constant with suffix
`u`

or `U`

(see section 4.13 Literals) is a term of sort
`unsignedInt`

; for example, `2U`

is treated as a synonym of
`succ(succ(0))`

.

Go to the first, previous, next, last section, table of contents.