DADiSP Worksheet Functions > Function Categories > Data Type Conversion > BYTESWAP
Reverses the bytes of an input series.
BYTESWAP(series, datatype)
series |
- |
A series, the values to swap. |
datatype |
- |
Optional. An integer, the binary data type for the output values described by either its macro name or integer code. Defaults to DOUBLE. Valid arguments are: |
Name |
Code |
Data Type |
Range |
INT8 SBYTE |
1 |
8-bit Signed Byte |
-128 to +127 |
UINT8 UBYTE BYTE |
2 |
8-bit Unsigned Byte |
0 to 255 |
INT16 SINT |
3 |
16-bit (2-byte) Signed Integer |
-32768 to +32767 |
UINT16 UINT |
4 |
16-bit (2-byte) Unsigned Integer |
0 to 65535 |
INT32 LONG |
5 |
32-bit (4-byte) Signed Integer |
-2,147,483,648 to +2,147,483,647 |
FLOAT |
6 |
32-bit (4-byte) Floating Point |
-1037 to +1038 |
DOUBLE |
7 |
64-bit (8-byte) Floating Point |
-10-307 to +10308 |
UINT32 ULONG |
8 |
32-bit (4-byte) Unsigned Integer |
0 to 4,294,967,295 |
INT64 |
9 |
64-bit (8-byte) Signed Integer |
-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 |
UINT64 |
10 |
64-bit (8-byte) Unsigned Integer |
0 to 18,446,744,073,709,551,615 |
|
1000 + N |
N-byte Signed Integer |
-28N-1 to 28N-1-1 |
|
2000 + N |
N-byte Unsigned Integer |
0 to 28N-1 |
A series or table.
byteswap(W1, INT16)
converts W1 into signed 2 byte integers and then reverses the bytes.
byteswap(W1, SINT)
converts W1 into signed 2 byte integers and then reverses the bytes.
BYTESWAP can be very useful when reading foreign data files via READB.