Added IntPtrCmp, IntPtrCmpU, Int64Cmp and Int64CmpU
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6930 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
34e9873d5f
commit
1a039ca71f
9 changed files with 99 additions and 61 deletions
|
@ -683,18 +683,27 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_INTOPTS
|
||||
case EW_INTCMP:
|
||||
{
|
||||
int v,v2;
|
||||
v=GetIntFromParm(0);
|
||||
v2=GetIntFromParm(1);
|
||||
if (!parm5) {
|
||||
// signed
|
||||
if (v<v2) return parm3;
|
||||
if (v>v2) return parm4;
|
||||
UINT supp64=sizeof(void*) > 4, opu=supp64 ? (BYTE) parm5 : parm5, op64=supp64 ? (INT16) parm5 < 0 : FALSE;
|
||||
INT_PTR v=GetIntPtrFromParm(0), v2=GetIntPtrFromParm(1); // Note: This needs to be INT64 if supp64 is ever set to true for 32-bit builds!
|
||||
if (!opu) { // signed:
|
||||
if (op64) {
|
||||
if ((INT64)v < (INT64)v2) return parm3;
|
||||
if ((INT64)v > (INT64)v2) return parm4;
|
||||
}
|
||||
else {
|
||||
if ((signed int)v < (signed int)v2) return parm3;
|
||||
if ((signed int)v > (signed int)v2) return parm4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// unsigned
|
||||
if ((unsigned int)v<(unsigned int)v2) return parm3;
|
||||
if ((unsigned int)v>(unsigned int)v2) return parm4;
|
||||
else { // unsigned:
|
||||
if (op64) {
|
||||
if ((UINT64)v < (UINT64)v2) return parm3;
|
||||
if ((UINT64)v > (UINT64)v2) return parm4;
|
||||
}
|
||||
else {
|
||||
if ((unsigned int)v < (unsigned int)v2) return parm3;
|
||||
if ((unsigned int)v > (unsigned int)v2) return parm4;
|
||||
}
|
||||
}
|
||||
}
|
||||
return parm2;
|
||||
|
|
|
@ -96,7 +96,7 @@ enum
|
|||
EW_READENVSTR, // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead]
|
||||
#endif
|
||||
#ifdef NSIS_SUPPORT_INTOPTS
|
||||
EW_INTCMP, // IntCmp: 6 [val1, val2, equal, val1<val2, val1>val2, unsigned?]
|
||||
EW_INTCMP, // IntCmp: 6 [val1, val2, equal, val1<val2, val1>val2, flags] where flags: bit 0x01 is set for unsigned operations and bit 0x8000 is set for 64-bit operations
|
||||
EW_INTOP, // IntOp: 4 [output, input1, input2, op] where op: 0=add, 1=sub, 2=mul, 3=div, 4=bor, 5=band, 6=bxor, 7=bnot input1, 8=lor, 9=land 10=mod, 11=shl, 12=sar, 13=shr (bneg is implemented with bxor in compiler)
|
||||
EW_INTFMT, // IntFmt: [output, format, input]
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue