Abs: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
mNo edit summary
m (Reverted edits by 199.48.147.37 to last version by Lloigor)
 
(One intermediate revision by one other user not shown)
(No difference)

Latest revision as of 17:22, 15 August 2012

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