Index | PAL Intro | Commands | Registers | Indices | Stack | Macros | Classes | Attributes | Errors
reg/lcmp - Rolling byte comparisons
Synopsis
Description
Error Handling
Examples
See Also
Author
reg/lcmp write, #cmp1, #cmp2
reg/lcmp write, #cmp1, #cmp2, #maskreg/rcmp write, #cmp1, #cmp2
reg/rcmp write, #cmp1, #cmp2, #mask
Performs a byte-by-byte comparison of two 32-bit integers (raw indices) provided in the cmp1 and cmp2 arguments, returning the number of octets that matched in the write argument.
The reg/lcmp instruction performs a rolling left comparison of the two indices. Each octet is compared starting at the left-most octet, and the number of matching octets is returned in the write argument.
The reg/rcmp instruction performs a rolling right comparison of the two indices. Each octet is compared starting at the right-most octet, and the number of matching octets is returned in the write argument.
If a mask argument is provided with either instruction, it is applied using a bitwise AND operation to both cmp1 and cmp2 values before the comparison begins.
A runtime error is generated if a write argument is not a register or if a cmp1, cmp2 or mask argument is not a number (raw index) nor a register containing one.
reg/lcmp P0, #0x11223344, #0x11223355 Returns the value 3 in register P0, because the left-most three octets match in the given arguments. reg/rcmp PUSH, #0xa2580913, #0x10580913, #0xffffff Pushes the value 4 to the stack, because the right-most four octets all match in the given arguments after the mask is applied.
pal_commands(5), pal_registers(5), pal_indices(5), op_mask(5), op_swap(5),
PROSE Assembly Language at prose.sourceforge.net.
Copyright (c) 2002-2011 Mark R. Bannister <cambridge@users.sourceforge.net>.
This is free software and can be downloaded from prose.sourceforge.net; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
PAL 1.0 | reg_lcmp (5) | 14 January 2011 |