Intel® Fortran Compiler 17.0 Developer Guide and Reference
This little-endian-big-endian conversion feature is intended for Fortran unformatted input/output operations. It enables the development and processing of files with little-endian and big-endian data organization.
The F_UFMTENDIAN environment variable is processed once at the beginning of program execution. Whatever it specifies for specific units or for all units continues for the rest of the execution.
Specify the numbers of the units to be used for conversion purposes by setting F_UFMTENDIAN. Then, the READ/WRITE statements that use these unit numbers will perform relevant conversions. Other READ/WRITE statements will work in the usual way.
In the general case, the variable consists of two parts divided by a semicolon. No spaces are allowed inside the F_UFMTENDIAN value:
F_UFMTENDIAN=MODE | [MODE;] EXCEPTION
where:
MODE = big | little
EXCEPTION = big:ULIST | little:ULIST | ULIST
ULIST = U | ULIST,U
U = decimal | decimal -decimal
MODE defines current format of data, represented in the files; it can be omitted.
The keyword little means that the data has little endian format and will not be converted. This is the default.
The keyword big means that the data has big endian format and will be converted.
EXCEPTION is intended to define the list of exclusions for MODE.EXCEPTION keyword (little or big) defines data format in the files that are connected to the units from the EXCEPTION list. This value overrides MODE value for the units listed.
The EXCEPTION keyword and the colon can be omitted. The default when the keyword is omitted is big.
Each list member U is a simple unit number or a number of units. The number of list members is limited to 64.
decimal is a non-negative decimal number less than 232.
Converted data should have basic data types or arrays of basic data types. Derived data types are disabled.
Error messages may be issued during the little-endian-to-big-endian conversion. They are all fatal.
On Linux* systems, the command line for the variable setting in the shell is:
Sh: export F_UFMTENDIAN=MODE;EXCEPTION
The environment variable value should be enclosed in quotes if the semicolon is present.
The environment variable can also have the following syntax:
F_UFMTENDIAN=u[,u] . . .
F_UFMTENDIAN=big
All input/output operations perform conversion from big-endian to little-endian on READ and from little-endian to big-endian on WRITE.
F_UFMTENDIAN="little;big:10,20"
or F_UFMTENDIAN=big:10,20
or F_UFMTENDIAN=10,20
The input/output operations perform big-endian to little endian conversion only on unit numbers 10 and 20.
F_UFMTENDIAN="big;little:8"
No conversion operation occurs on unit number 8. On all other units, the input/output operations perform big-endian to little-endian conversion.
F_UFMTENDIAN=10-20
The input/output operations perform big-endian to little-endian conversion on units 10, 11, 12 , ... 19, 20.
Assume you set F_UFMTENDIAN=10,100 and run the following program.
|
Now compare lit.tmp and big.tmp files with the help of the od utility:
> od -t x4 lit.tmp
0000000 00000008 00000315 00000000 00000008
0000020 00000004 000001c8 00000004
0000034
> od -t x4 big.tmp
0000000 08000000 00000000 15030000 08000000
0000020 04000000 c8010000 04000000
0000034
You can see that the byte order is different in these files.