sorry it is not .AXLINEDATA.nLineBreak in question
but .AXLINEDATA.nLineWidth
however it is translated in to :
0000000140054BA7 cmp dword ptr ,eax
0000000140054BAA jge 0000000140055017
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> however it is translated in to
>: 0000000140054BA7 cmp dword ptr ,eax
> 0000000140054BAA jge 0000000140055017
I don't see the problem. "jae" is generated if unsigned values are compared, and "jge" is generated if signed values are compared. Since nLineWidth is signed, all looks ok. Am I missing something?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
my question is why is .if ( < eax)
compiled to jae
how did compiler make decision that it is jae and not jge when there is nothing telling it about SIGNED or NOT?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
sorry to bother you
I don't know why I thought that jge is unsigned and jae unsigned
actually, I know: my IGNORANCE
I rarely use cmp because I like C stile .if
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Japheth
can you please explain why is
.if ( < eax) compiled to:
0000000140054BA7 cmp dword ptr ,eax
0000000140054BAA jae 0000000140055017
and
.if (.AXLINEDATA.nLineBreak < eax)compiled to:
0000000140054BA7 cmp dword ptr ,eax
0000000140054BAA jge 0000000140055017
I have bug in my program because of it
regards
jae is good
jge is bad
> can you please explain why is
No - you haven't supplied the declaration of AXLINEDATA. But I guess the difference is due to how member nLineBreak is defined - signed or unsigned.
AXLINEDATA struct
next INT_PTR ?
prev INT_PTR ?
wpLine INT_PTR ?
nLineLen SDWORD ?
nLineBreak BYTE ?
nLineFlags BYTE ?
nReserved WORD ?
nLineWidth SDWORD ?
nSelStart SDWORD ?
nSelEnd SDWORD ?
AXLINEDATA ends
anyway
why is considered as signed?
and .AXLINEDATA.nLineBreak as usigned
sorry it is not .AXLINEDATA.nLineBreak in question
but .AXLINEDATA.nLineWidth
however it is translated in to :
0000000140054BA7 cmp dword ptr ,eax
0000000140054BAA jge 0000000140055017
> however it is translated in to
>: 0000000140054BA7 cmp dword ptr ,eax
> 0000000140054BAA jge 0000000140055017
I don't see the problem. "jae" is generated if unsigned values are compared, and "jge" is generated if signed values are compared. Since nLineWidth is signed, all looks ok. Am I missing something?
yes, have look again I tried it again and still the same resoult
mov eax, DWORD PTR dwMaxWidth
.if (.AXLINEDATA.nLineWidth < eax)
0000000140054BA4 mov eax,dword ptr
0000000140054BA7 cmp dword ptr ,eax
0000000140054BAA jge 0000000140054F40
I tried with mov eax, SDWORD PTR dwMaxWidth
with .if (SDWORD PTR.AXLINEDATA.nLineWidth < SDWORD PTR eax)
and still the same
only
.if ( < eax) is compiled to:
0000000140054BA7 cmp dword ptr ,eax
0000000140054BAA jae 0000000140055017
my question is why is .if ( < eax)
compiled to jae
how did compiler make decision that it is jae and not jge when there is nothing telling it about SIGNED or NOT?
I'd say you are confused. If you want an unsigned comparison, you'll have to write:
.if DWORD PTR .AXLINEDATA.nLineWidth < eax
if there's no typecast ("DWORD PTR"), the comparison will be signed.
Just write a 32-bit version and test it with Masm, you'll see that it behaves equally.
you were right, with:
mov eax, DWORD PTR dwMaxWidth
.if (DWORD PTR.AXLINEDATA.nLineWidth < eax)
I have finally got it
0000000140054BA7 cmp dword ptr ,eax
0000000140054BAA jae 0000000140054F40
however, why SDWORD PTR doesn't give the same result?
IMO it would be more logical that SDWORD PTR create signed and DWORD PTR unsigned
however, thank you Japheth for solving the mistery
> IMO it would be more logical that SDWORD PTR create signed and DWORD PTR unsigned
Yes …. that's what they actually DO!
> however, thank you Japheth for solving the mistery
You're welcome! However, there's no mystery . take a break, and then review the Intel manuals, JCC instruction!
sorry to bother you
I don't know why I thought that jge is unsigned and jae unsigned
actually, I know: my IGNORANCE
I rarely use cmp because I like C stile .if