Skip to content

Commit 0d032c5

Browse files
ZERICO2005adriweb
authored andcommitted
optimize i64 bitwise operations
1 parent 6018d31 commit 0d032c5

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

src/crt/lland.src

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
section .text
44
public __lland
55
__lland:
6-
; CC: 62*r(PC)+25*r(SPL)+14*w(SPL)+1
6+
; CC: 61*r(PC)+25*r(SPL)+14*w(SPL)+1
77
push af
88
push iy
99
ld iy, 0
@@ -33,9 +33,10 @@ __lland:
3333
and a, (hl)
3434
ld e, a
3535
dec hl
36-
ld a, (iy - 1)
36+
ld a, (hl)
37+
lea hl, iy - 1
3738
and a, (hl)
38-
ld (iy - 1), a
39+
ld (hl), a
3940
pop hl
4041
ld a, h
4142
and a, (iy + 10)

src/crt/lland_fast.src

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
section .text
44
public __lland_fast
55
__lland_fast:
6-
; CC: 56*r(PC)+19*r(SPL)+8*w(SPL)+1
6+
; CC: 55*r(PC)+19*r(SPL)+8*w(SPL)+1
77
ld iy, 0
88
add iy, sp
99
push hl
@@ -31,9 +31,10 @@ __lland_fast:
3131
and a, (hl)
3232
ld e, a
3333
dec hl
34-
ld a, (iy - 1)
34+
ld a, (hl)
35+
lea hl, iy - 1
3536
and a, (hl)
36-
ld (iy - 1), a
37+
ld (hl), a
3738
pop hl
3839
ld a, h
3940
and a, (iy + 4)

src/crt/llor.src

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
section .text
44
public __llor
55
__llor:
6-
; CC: 62*r(PC)+25*r(SPL)+14*w(SPL)+1
6+
; CC: 61*r(PC)+25*r(SPL)+14*w(SPL)+1
77
push af
88
push iy
99
ld iy, 0
@@ -33,9 +33,10 @@ __llor:
3333
or a, (hl)
3434
ld e, a
3535
dec hl
36-
ld a, (iy - 1)
36+
ld a, (hl)
37+
lea hl, iy - 1
3738
or a, (hl)
38-
ld (iy - 1), a
39+
ld (hl), a
3940
pop hl
4041
ld a, h
4142
or a, (iy + 10)

src/crt/llor_fast.src

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
section .text
44
public __llor_fast
55
__llor_fast:
6-
; CC: 56*r(PC)+19*r(SPL)+8*w(SPL)+1
6+
; CC: 55*r(PC)+19*r(SPL)+8*w(SPL)+1
77
ld iy, 0
88
add iy, sp
99
push hl
@@ -31,9 +31,10 @@ __llor_fast:
3131
or a, (hl)
3232
ld e, a
3333
dec hl
34-
ld a, (iy - 1)
34+
ld a, (hl)
35+
lea hl, iy - 1
3536
or a, (hl)
36-
ld (iy - 1), a
37+
ld (hl), a
3738
pop hl
3839
ld a, h
3940
or a, (iy + 4)

src/crt/llxor.src

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
section .text
44
public __llxor
55
__llxor:
6-
; CC: 62*r(PC)+25*r(SPL)+14*w(SPL)+1
6+
; CC: 61*r(PC)+25*r(SPL)+14*w(SPL)+1
77
push af
88
push iy
99
ld iy, 0
@@ -33,9 +33,10 @@ __llxor:
3333
xor a, (hl)
3434
ld e, a
3535
dec hl
36-
ld a, (iy - 1)
36+
ld a, (hl)
37+
lea hl, iy - 1
3738
xor a, (hl)
38-
ld (iy - 1), a
39+
ld (hl), a
3940
pop hl
4041
ld a, h
4142
xor a, (iy + 10)

src/crt/llxor_fast.src

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
section .text
44
public __llxor_fast
55
__llxor_fast:
6-
; CC: 56*r(PC)+19*r(SPL)+8*w(SPL)+1
6+
; CC: 55*r(PC)+19*r(SPL)+8*w(SPL)+1
77
ld iy, 0
88
add iy, sp
99
push hl
@@ -31,9 +31,10 @@ __llxor_fast:
3131
xor a, (hl)
3232
ld e, a
3333
dec hl
34-
ld a, (iy - 1)
34+
ld a, (hl)
35+
lea hl, iy - 1
3536
xor a, (hl)
36-
ld (iy - 1), a
37+
ld (hl), a
3738
pop hl
3839
ld a, h
3940
xor a, (iy + 4)

0 commit comments

Comments
 (0)