-
0xff padding?
i have this code
Code:
int next_byte(char **filebuf, int *psize)
{
if (*psize) {
(*psize)--;
return *(*filebuf)++;
}
return END_BUF;
}
The next byte in filebuf is, say, 0xd8, but next_byte will return 0xffffffd8. Is there any particular reason why its not returning 0x000000d8
-
Does this do the same thing for any hex value above 0x80?
-
casting the return statement didnt work, but chaning the param to unsigned char did. Thanks.
-
> yep
If that was to me, then read Salem's explanation - that's why; sign extension.