SPL to HP C/XL Migration Guide (30231-90001)
5- 20
| | |
| +
(unsigned addition)
| |
| -
(unsigned subtraction)
| |
| *
(unsigned multiplication)
| |
| /
(unsigned division)
| |
| MOD
(unsigned modulus)
| %
(unsigned modulus)
|
| **
(unsigned multiplication)
| *
(unsigned multiplication)
|
| //
(unsigned division)
| /
(unsigned division)
|
| MODD
(unsigned modulus)
| %
(unsigned modulus)
|
| | |
| (**, //, and MODD give DOUBLE result) | Use (long int) cast if needed for the |
| | conversions from **, //, and MODD. |
| | |
---------------------------------------------------------------------------------------------
| | |
| The
logical-op
operators perform unsigned | Similar to SPL. Operands may be any numeric |
| integer arithmetic on their operands and | types. Results correspond to operand |
| produce a numeric result of type LOGICAL. | types. |
| | |
---------------------------------------------------------------------------------------------
| | |
|
rel-op
: | Same as SPL, except: |
| | |
| <
(less than)
| |
| <=
(less than or equal to)
| |
| >
(greater than)
| |
| >=
(greater than or equal to)
| |
| =
(equal to)
| ==
(equal to)
|
| <>
(not equal to)
| !=
(not equal to)
|
| | |
| Note: The SPL equality operator, "=", is | |
| the HP C/XL assignment operator. | |
| | |
---------------------------------------------------------------------------------------------
| | |
| The
rel-op
operators perform arithmetic | Similar to SPL, except: True is returned |
| comparisons on their operands and produce a | as int 1. False is returned as int 0. |
| Boolean result (true or false) of type | |
| LOGICAL. | Operands may be any numeric types. Results |
| | correspond to operand types. |
| True is returned as LOGICAL 65535 (INTEGER | |
| -1). False is returned as LOGICAL 0. | |
| | |
---------------------------------------------------------------------------------------------
| | |
| The reserved word TRUE has the LOGICAL | No direct equivalent. |
| value 65535 (INTEGER -1). | |
| | You could use #define directives to define |
| The reserved word FALSE has the LOGICAL | SPLTRUE as 65535 and SPLFALSE as 0: |
| value 0 (INTEGER 0). | |
| | #define SPLTRUE 65535 |
| | #define SPLFALSE 0 |
| | |
| | and then change all TRUE and FALSE |
| | references to the special names. This |
| | would help you to locate instances where |
| | they were used in bit or numeric |
| | operations. |
| | |
---------------------------------------------------------------------------------------------
| | |
| In tests for true and false, an odd number | A nonzero number is true; a zero number is |
| is true (bit 15 is on); an even number is | false. |
| false (bit 15 is off). | |
| | |
---------------------------------------------------------------------------------------------
| | |
| Examples: | Examples: |
| | |
| L | L |
| L + NOT L1 LAND L2 | L + ~L1 & L2 |
| I <= N <= 100 | I <= N & N <= 100 |
| L | L != L1 |
| L1 | L ^ L1 % L2 |
| L XOR L1 MOD L2 | |
---------------------------------------------------------------------------------------------