only change sign when value is not 0

This commit is contained in:
ceriel 1988-06-29 16:34:40 +00:00
parent 1f07fc05a4
commit 78f0107cb8
2 changed files with 8 additions and 4 deletions

View file

@ -21,7 +21,9 @@ _float f;
{
char unsigned *p;
p = (char unsigned *) &f;
*p ^= 0x80;
if (f != (_float) 0) {
p = (char unsigned *) &f;
*p ^= 0x80;
}
}

View file

@ -21,7 +21,9 @@ _double f;
{
unsigned char *p;
p = (unsigned char *) &f;
*p ^= 0x80;
if (f[0] != 0 || f[1] != 0) {
p = (unsigned char *) &f;
*p ^= 0x80;
}
}