Syntax for testing an array of variables?
Is there any syntax in Spin to test an array of variables, for example in an IF statement? Something like this:
VAR
BYTE variable[4]
PUB
IF variable == [1, 1, 1, 1]
someMethod
...instead of
IF variable[1] == 1 AND variable[2] ==1 AND variable[3]==1 AND variable[4]==1
someMethod
VAR
BYTE variable[4]
PUB
IF variable == [1, 1, 1, 1]
someMethod
...instead of
IF variable[1] == 1 AND variable[2] ==1 AND variable[3]==1 AND variable[4]==1
someMethod
Comments
In special cases: Yes
For example:
.. if you want to compare an array of 4 bytes you could simply do a long compare instead. (of course you have to assure that the bytes are long-alligned)
.. if you can assure that 0 is not a valid value of each array-element, you can use string compare function.