Re: Declaration to get 8-bit (or 16-bit) integer?



In message <epohfj$j3m$1@xxxxxxxxxxxxxxxxxx>, Paul van Delst <Paul.vanDelst@xxxxxxxx> writes
But seriously, I use this for the multi-byte case:

MODULE Endian_Utility
USE Type_Kinds
IMPLICIT NONE
CONTAINS
FUNCTION Big_Endian()
INTEGER(Short) :: Source = 1_Short
LOGICAL :: Big_Endian
Big_Endian = .FALSE.
IF ( IACHAR(TRANSFER(Source,'a')) == 0 ) Big_Endian = .TRUE.
END FUNCTION Big_Endian
....
END MODULE Endian_Utility

That looks very similar to a module that I posted some years ago. If only I could remember how it worked :-)


Now to a more difficult topic: how to get the effect of LOGICAL*1

What for? :o)

If you want a really large array of logicals, e.g. flags for bad pixels in a huge image, then the difference between 1-byte and 4-byte data can be significant.


--
Clive Page
.