This is my issue/incertainty.
In one of my applications, I have a matrix mat
of integer(int8)
that contains compressed data. Values of mat
might be negative or positive. Compressed elements correspond to two bits of the int8
integers.
Decompression is done using ibits
, e.g.:
integer(int8), allocatable :: mat(:,:)
real, parameter :: decomp(0:3) = [....]
real :: tmp
...
tmp = decomp( ibits(mat(i,j), 6, 2) )
...
So, I think that this use must assume two’s complement arithmetic, especially as I use the last bit of possibly negative integers.