Abs

From NSIS Wiki
Jump to navigationJump to search
Author: Lloigor (talk, contrib)


A very simple macro to get an integer's absolute value.

!define Abs "!insertmacro _Abs"
!macro _Abs _RetVal_ _Value_
   IntOp ${_RetVal_} ${_Value_} & 0x7FFFFFFFFFFFFFFF
!macroend

Usage:

StrCpy $0 -40
${ABS} $0 $0  ; $0 = 40