
March 10, 1995
2:17 p.m.
[ for once i wish for a unidiff... 8-]
How about this simple change?
[ OLD ]
! result = 0; for (i = 0; i < 4; ++i) result = (result << 8) | (codep[i] & 0xff); return result;
[ NEW ]
! result = ~0; for (i = 0; i < 4; ++i) result = (result << 8) | (codep[i] & 0xff); return result;
right, but then you _always_ have the top 32 bits set. the point is to get the effect of sign extension on the MSB. You could also do something like: result = (int)result; right before you return the result. however, _that_ depends on the assumption that "int" is 32 bits, which definitely isn't true on all of the machines out there (unless i'm mistaken, it's not true on macintoshes with certain C compilers, and on crays)... cgd