Unsigned 8 bits integer in Fortran

Unsigned 8 bits integer in Fortran

Hi,

I need to work with images and I would like to know if there is a way to work with 8-bits unsigned integer in Fortran, with comparisons, additions,... I can't find a way to do that.

 

Best regards,

François

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Sun/Oracle Fortran, available for Linux and Solaris, has unsigned integers as a vendor extension.

If you want to use Intel Fortran, you should consider using, for example., C to write a few key functions that manipulate unsigned integers and call those functions/subroutines from Fortran.

You might perform unsigned arithmetic on integer(1) data type by promoting to a wider type and using e.g. and(i,z'ff') to zero out sign extension bits.  Is that one of your ways which doesn't work?

As mecej4 pointed out, you might use interoperable C functions to perform the arithmetic.  The signed vs. unsigned problem would not arise even though you declare it as a signed Fortran data type, as long as you don't perform arithmetic (including I/O conversions) in Fortran.

 

One could use ZEXT to zero-extend the value and compare that way.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today