unsigned images
Nicolas Devillard
ndevilla at eso.org
Fri Feb 21 07:00:57 EST 1997
On Fri, 21 Feb 1997, Michael Olberg wrote:
[...]
> I think, the following code is ANSI compliant:
>
> int i;
> short data[DATALEN];
> for (i = 0; i < DATALEN; i++) {
> data[i] ^= (1<<15);
> }
[...]
ANSI, but not portable. If on your machine (and compiler) 'int i' means
'short int i', you may well run into trouble when addressing more than 32
kpixels. Furthermore, when declaring 'short data[DATALEN]', nothing
ensures that 'data' contains 16 bit integers, nor should any assumption be
made on the its sign. Portability...
Have a look in C FAQ's about portability and machine endian-ness. You may
well find answers to your problem there, together with simple source codes
for data conversion.
Hope it helps,
--Nicolas
____________________________________________________________________
/\ \
\_| Nicolas Devillard | E-mail: nDevil at eso.org |
| European Southern Observatory, | http://www.eso.org/~ndevilla |
| Karl-Schwarzschild-Str. 2, | Phone: +49 89 320-06-340 |
| D-85748 Garching, Germany | Fax : +49 89 320-06-358 |
| ________________________________________________________________|_
\_/__________________________________________________________________/
More information about the fitsbits
mailing list