pTAL Conversion Guide

pTAL Built-In Routines
pTAL Conversion Guide527302-002
18-10
$ATOMIC_ADD
$ATOMIC_ADD
$ATOMIC_ADD, an atomic operation, increments a variable by a specified value.
var input,output
sINT:variable
is the variable that $ATOMIC_ADD increments.
value input
sINT:value
is the value $ATOMIC_ADD adds to var.
$ATOMIC_ADD performs the following operation:
var := var + value
Examples of $ATOMIC_ADD:
Sets condition code Yes (according the final value of var )
Sets $CARRY Yes, if traps are disabled
Sets $OVERFLOW Yes, if traps are disabled; otherwise, traps on overflow
Example 18-2. Call to $ATOMIC_ADD Routine
INT var;
INT value;
$ATOMIC_ADD (var, value);
var value result
%H1234 %HAAAA %HBCDE
%H1234 %H5555 %H6789
%H6789 %HAAAA %H1233
%H6789 %H5555 %HBCDE
$ATOMIC_ADD ( ) ;
VST607.vsd
var , value