Mail Archives: djgpp/1997/03/13/10:39:04
Dave Smith (nizea AT es DOT co DOT nz) wrote:
: Heya peoples,
: I have a simple question (I hope) for some of you out there :)
: How in C (esp. GCC) do I find the high order of a byte, in Turbo
: pascal I would do this... a := Hi($1234) which would return ($12),
: how can I do this in DJGPP?
That's a word, not a byte...
Anyway, to find the high order byte of a word you would shift it right by
8 places, e.g.
(((0x1234) >> 8) == (0x12)) is true.
If there are higher bits in the number (e..g it is an int) you will need
to & this with 0xff as well, to extract just that byte.
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -