Skip to content

Commit fd242c4

Browse files
committed
optimized neg to cpl in frexpf and ilogbl
1 parent 1c404ee commit fd242c4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/libc/frexpf.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ _frexpf:
5858
ld (iy + 3), hl
5959
scf
6060
sbc hl, hl
61-
neg
62-
add a, 130 ; 127 + 3? idk where this magic number comes from
61+
cpl
62+
add a, 131 ; 127 + 3 + 1? idk where this magic number comes from
6363
ld l, a
6464
ld a, b ; exponent
6565
xor a, $3F

src/libc/ilogbl.src

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ _ilogbl:
4141
cp a, 64
4242
sbc hl, hl
4343
jr z, .ret_zero ; A was 64
44-
neg
44+
cpl
4545
ld l, a
46-
; -1023 + 11 + 1
46+
; -1023 + 11 + 1 + 1
4747
; Float64_ilogb_subnorm_max + Float64_exponent_bits + Float64_sign_bits
48-
ld de, -1011
48+
ld de, -1010
4949
add hl, de
5050
ret
5151

0 commit comments

Comments
 (0)