]> wirehaze git hosting - lifeboot.git/commitdiff

wirehaze git hosting

microoptimization for update_cell
authorphfr24 <phfr24@inf.ufpr.br>
Tue, 16 Dec 2025 00:37:33 +0000 (21:37 -0300)
committerphfr24 <phfr24@inf.ufpr.br>
Tue, 16 Dec 2025 00:37:33 +0000 (21:37 -0300)
lifeboot.asm

index d4ba435081f7892280834e2b6e67274773c483c9..67e7ce99b56247f0e328aefbec5388a59c8d71af 100644 (file)
@@ -291,11 +291,9 @@ mov dx, [es:si + bx]        ; dl = cell current state
 cmp dl, ALIVE               ; if (ALIVE) {
 jne .else
 
-cmp ax, 2                   ;     if (n < 2)
-jl .dead                    ;         return DEAD
-
-cmp ax, 3                   ;     if (n > 3)
-jg .dead                    ;         return DEAD
+shr ax, 1
+xor ax, 1                   ;     if (n != 2 || n != 3)
+jnz .dead                   ;         return DEAD (likely)
 
 jmp .alive                  ;     return ALIVE