Mail Archives: djgpp/1997/12/06/09:18:47
On Thu, 4 Dec 1997 thanks AT ok DOT com wrote:
|Hi Everyone,
|
|I have a quick question. I just downloaded DJGPP and I see that
|the integers are 4 bytes not 2 bytes, like other compilers. The
|question is why? ...
Because DJGPP produces "32-bit-clean" binaries, which means they run with
a default data size of 32 bits. Accessing smaller data actually slows
down the CPU due to misaligned data and as well, in order to do so in
32-bit protected mode a prefix code has to be applied to the instruction
in question which adds (at the least) one more cycle to the execution
time. This is a 'feature' of the IAPX[3]86.
...
|Also, I created a binary file using TC++ and
|would like to know if there's any problem with reading in the
|integers from it.
Just read them as shortints. Ie:
int readshortint(int file)
{
short d;
read(f,d,sizeof(d));
return(d);
}
Wil Barath, aka WseM : "I feel as though I see my pen to write"
Author of VPM, EDITPLN, and other VGA Planets support programs
Visit my homepage! -------------> http://victoria.tc.ca/~wi534
- Raw text -