summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Optimizing-assembly-code.md12
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
```