Skip to content

Commit bb271da

Browse files
committed
optimize some float routines
1 parent 420f2e8 commit bb271da

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/libc/ceilf.src

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@
1515

1616
_ceil:
1717
_ceilf:
18-
call __frameset0
19-
ld bc, (ix+6)
20-
ld a, (ix+9)
18+
ld hl, 6
19+
add hl, sp
20+
ld a, (hl)
21+
dec hl
22+
dec hl
23+
dec hl
24+
ld bc, (hl)
2125
call __fneg
2226
ld l, a
23-
ld h, 0
2427
push hl
2528
push bc
2629
call _floor
2730
pop bc
28-
pop bc
29-
push hl
31+
ex (sp), hl
3032
pop bc
3133
ld a, e
3234
call __fneg
3335
ld e, a
3436
push bc
3537
pop hl
36-
pop ix
3738
ret
3839

39-
.extern __frameset0
4040
.extern __fneg
4141
.extern _floor
4242

src/libc/cimagf.src

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
; float cimagf(float _Complex)
1111
_cimagf:
1212
_cimag:
13-
ld iy, 0
14-
add iy, sp
15-
ld sp, iy
16-
ld hl, (iy + 7)
17-
ld e, (iy + 10)
13+
ld hl, 10
14+
add hl, sp
15+
ld e, (hl)
16+
dec hl
17+
dec hl
18+
dec hl
19+
ld hl, (hl)
1820
ret

src/libc/cimagl.src

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
_cimagl:
1010
ld iy, 0
1111
add iy, sp
12-
ld sp, iy
1312
ld hl, (iy + 11)
1413
ld de, (iy + 14)
1514
ld bc, (iy + 17)

0 commit comments

Comments
 (0)