71 lines
No EOL
1.9 KiB
Text
71 lines
No EOL
1.9 KiB
Text
#-------------------------------------------------------------------------------
|
|
# _Add
|
|
# Adds two numbers and returns the result ($one + $two)
|
|
#-------------------------------------------------------------------------------
|
|
Sub _Add(IN int $one, IN int $two, OUT int $result)
|
|
{
|
|
|
|
$result = $one;
|
|
$result += $two;
|
|
return true;
|
|
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# _Subtract
|
|
# Returns the difference between two numbers ($one - $two)
|
|
#-------------------------------------------------------------------------------
|
|
Sub _Subtract(IN int $one, IN int $two, OUT int $result)
|
|
{
|
|
|
|
$result = $one;
|
|
$result -= $two;
|
|
return true;
|
|
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# _Multiply
|
|
# Returns the multiplication of two numbers ($one * $two)
|
|
#-------------------------------------------------------------------------------
|
|
Sub _Multiply(IN int $one, IN int $two, OUT int $result)
|
|
{
|
|
|
|
$result = $one;
|
|
$result *= $two;
|
|
return true;
|
|
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# _Divide
|
|
# Returns the (integer) division of two numbers as well as
|
|
# the remainder ($one / $two)
|
|
#-------------------------------------------------------------------------------
|
|
Sub _Divide(IN int $one, IN int $two, OUT int $result, OUT int $remainder)
|
|
{
|
|
|
|
if ($two == 0) {
|
|
return false;
|
|
}
|
|
|
|
$result = $one;
|
|
$result /= $two;
|
|
$remainder = $one;
|
|
$remainder %= $two;
|
|
return true;
|
|
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# _Divide
|
|
# Returns the (integer) division of two numbers ($one / $two)
|
|
#-------------------------------------------------------------------------------
|
|
Sub _Divide(IN int $one, IN int $two, OUT int $result)
|
|
{
|
|
|
|
$result = $one;
|
|
$result /= $two;
|
|
return true;
|
|
|
|
} |