2 ms·
> Can someone explain? && short-circuits, so before each &&, if the LHS is false it will jump to the end of the whole thing with a `false` result If you plug
by masklinn 11y ago
> Can someone explain?
&& short-circuits, so before each &&, if the LHS is false it will jump to the end of the whole thing with a `false` result
If you plug the function into goldbot (http://rust.godbolt.org http://rust.godbolt.org) you see a bunch of conditional jumps:
cmpl $7, %ecx
jb .LBB0_10
movzbl %dil, %ecx
cmpl $47, %ecx
je .LBB0_10
cmpl $44, %ecx
je .LBB0_10
movb %dil, %dl
andb $-2, %dl
movzbl %dl, %edx
cmpl $40, %edx
je .LBB0_10
cmpl $34, %ecx
je .LBB0_10
cmpl $33, %ecx
jb .LBB0_10
testb %dil, %dil
js .LBB0_10
- chrisdew 11y agoThanks, I'd not seen godbolt before - this is very useful.