Contents | Prev | Next

7.2.63 The swap function

Description

The swap function returns an integer value that is calculated by reversing the order of the bytes in the parameter passed to it. In other words this function converts little endian integer values to big endian integer values and vice-versa.

Parameter

The swap function's only parameter is an expression of integral type.

Example

For example, assuming 32 bit little endian integers then 256 is stored in four bytes as follows:

   0 0 1 0

So swap(256) results in the following integer:

   0 1 0 0

which is equal to 65536

Portability

Operating Systems: All
Standard Pascal: No

Contents | Prev | Next