There is no stdint.h file with Watcom 9.01d.Quote:
Doesn't Watcom C support __int64? If not, then see if it has stdint.h and look for int64_t
Printable View
There is no stdint.h file with Watcom 9.01d.Quote:
Doesn't Watcom C support __int64? If not, then see if it has stdint.h and look for int64_t
Watcom C compiler - Wikipedia, the free encyclopedia says that the version 11 added 64-bit support.
--
Mats
So far as I can tell it's more like (x/256) rounded toward zero.
More specifically: the extension makes edx all 1 or all 0; the shl will put eight zeros at the end and set the carry bit where appropriate; the sbb will either do nothing (if eax was positive) or, if eax was negative will give the same exact upper eight bits only if the lower eight bits are all zero, otherwise it will be one more than that. [For instance, -512 gives -512(+ stuff in the lower eight bits) because of the carry bit, but -511 gives -256(+ stuff).] The shr then cuts out the last eight bits, doing the division.
You totally lost me!!! Any way to break it down to more "simple" term that a novice might understand?Quote:
So far as I can tell it's more like (x/256) rounded toward zero.
More specifically: the extension makes edx all 1 or all 0; the shl will put eight zeros at the end and set the carry bit where appropriate; the sbb will either do nothing (if eax was positive) or, if eax was negative will give the same exact upper eight bits only if the lower eight bits are all zero, otherwise it will be one more than that. [For instance, -512 gives -512(+ stuff in the lower eight bits) because of the carry bit, but -511 gives -256(+ stuff).] The shr then cuts out the last eight bits, doing the division.
OK, i tried the following piece of code:
And it actually produced the ASM code:Code:y = x/256;
y <<= 8;
x -= y;
cdq
shl edx 8
sbb eax, edx
Now comes the important question.....Since all this piece of code seems to do is clear edx, what's the purpose of it? Could it actually be used as an error check of some kind or something?
Actually, just using
y = x/256;
yields the three ASM operations (cdq, shl, sbb). But the question still remains as to it's purpose other than clearing edx??????
The purpose of what?
The purpose of the whole thing is to give you x/256, as you mentioned. That's what's left in eax when all is said and done, is x/256. edx gets set to something in the meantime, but that's just extra scratch work that needs to be done in order to compute the answer.
I understand now. Thanks to all who contributed to this thread.Quote:
The purpose of the whole thing is to give you x/256, as you mentioned. That's what's left in eax when all is said and done, is x/256. edx gets set to something in the meantime, but that's just extra scratch work that needs to be done in order to compute the answer.