- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One could use ZEXT to zero-extend the value and compare that way.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page