diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-21 10:42:13 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-21 10:42:13 -0400 |
commit | e88d72acc29f74c417ee5191bf009559575ca14c (patch) | |
tree | 5a1225670b2dcd9103d988a3c0e9dbfbad4ce08e /Optimizing-assembly-code.md | |
parent | 96947b3e1428bc1f530d97dbf0aa96c941a13dd5 (diff) |
bit 7, a
Diffstat (limited to 'Optimizing-assembly-code.md')
-rw-r--r-- | Optimizing-assembly-code.md | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Optimizing-assembly-code.md b/Optimizing-assembly-code.md index 9b28f12..e7bf5a9 100644 --- a/Optimizing-assembly-code.md +++ b/Optimizing-assembly-code.md @@ -919,15 +919,23 @@ If you don't need to preserve the value in `a`, then don't do: ``` ; 4 bytes, 4/5 cycles - cp $80 ; high bit means negative + cp $80 jr nc, .negative ``` +And don't do: + +``` + ; 4 bytes, 4/5 cycles + bit 7, a + jr nz, .negative +``` + Instead, do: ``` ; 3 bytes, 3/4 cycles - rlca ; high bit means negative + rlca jr c, .negative ``` |