INTEGER

[IntType] [UNSIGNED] INTEGER[n]

[IntType] UNSIGNEDn

An n-byte integer value. Valid values for n are: 1, 2, 3, 4, 5, 6, 7,or 8. If n is not specified for the INTEGER, the default is 8-bytes.

The optional IntType may specify either the BIG_ENDIAN (Sun/UNIX-type, valid only inside a RECORD structure) or LITTLE_ENDIAN (Intel-type) style of integers. These two IntTypes have opposite internal byte orders. If the IntType is missing, the integer is LITTLE_ENDIAN.

If the optional UNSIGNED keyword is missing, the integer is signed. Unsigned integer declarations may be contracted to UNSIGNEDn instead of UNSIGNED INTEGERn.

INTEGER Value Ranges

SizeSigned ValuesUnsigned Values
1-byte-128 to 1270 to 255
2-byte-32,768 to 32,7670 to 65,535
3-byte-8,388,608 to 8,388,6070 to 16,777,215
4-byte-2,147,483,648 to 2,147,483,6470 to 4,294,967,295
5-byte-549,755,813,888 to 549,755,813,8870 to 1,099,511,627,775
6-byte-140,737,488,355,328 to 140,737,488,355,3270 to 281,474,976,710,655
7-byte-36,028,797,018,963,968 to 36,028,797,018,963,9670 to 72,057,594,037,927,935
8-byte-9,223,372,036,854,775,808 to 9,223,372,036,854,775,8070 to 18,446,744,073,709,551,615

Example:

INTEGER1 MyValue := MAP(MyString = '1' => MyString, '0');
       //MyValue is 1 or 0, changing type from string to integer
UNSIGNED INTEGER1 MyValue := 255; //max value possible in 1 byte
UNSIGNED1 MyValue := 255;
       //MyValue contains the max value possible in a single byte
MyRec := RECORD
  LITTLE_ENDIAN INTEGER2 MyLittleEndianValue := 1;
  BIG_ENDIAN INTEGER2 MyBigEndianValue := 1;
       //the physical byte-order is opposite in these two
END