unsigned images

Michael Olberg olberg at oso.chalmers.se
Fri Feb 21 03:31:41 EST 1997


Russell E. Owen wrote:
> 
> 
> Saving that, does anyone know an ANSI standard portable method of toggling
> the sign bit on a large array of 16-bit integers? I looked into it a bit
> and am embarrassed to say that I ran into a brick wall.
> 
> -- Russell

I think, the following code is ANSI compliant:

int i;
short data[DATALEN];

for (i = 0; i < DATALEN; i++) {
    data[i] ^= (1<<15);
}

Or is it the size of the data array (under DOS perhaps) that you are
having 
problems with?

Regards,

---------------------------------------------------------------------------
Michael Olberg           | e-mail: olberg at oso.chalmers.se
Onsala Space Observatory | tel: +46-31-7725507 (work) +46-300-10778
(home) 
S-43992 Onsala, SWEDEN   | fax: +46-31-7725590
-------------------- This quote left blank intentionally
------------------




More information about the fitsbits mailing list