Date: Sat, 26 Jul 2025 11:52:30 +0100
On Saturday, July 26, 2025, Frederick Virchanza Gotham wrote:
>
> The opcode + operand to compare a register value with 0xFFFFFFFFFFFFFFFF
> is a few more bytes. Plus the 'jump' instructions have optimised forms such
> as 'jump if zero' and 'jump if non-zero' which are perfect for branching on
> nullptr.
>
We could actually use these optimized instructions for all bits one simply
by flipping all the bits before comparing:
not rdi // flip all one's to all zero's
test rdi, rdi
jz target_label
>
> The opcode + operand to compare a register value with 0xFFFFFFFFFFFFFFFF
> is a few more bytes. Plus the 'jump' instructions have optimised forms such
> as 'jump if zero' and 'jump if non-zero' which are perfect for branching on
> nullptr.
>
We could actually use these optimized instructions for all bits one simply
by flipping all the bits before comparing:
not rdi // flip all one's to all zero's
test rdi, rdi
jz target_label
Received on 2025-07-26 10:52:32