File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ __dtof_helper:
3232 push de
3333 pop bc
3434 ld l, 5
35- call __lshru
35+ call __lshru_nz
3636 push bc
3737 pop hl
3838.L.finish_inf_nan:
@@ -101,7 +101,8 @@ __dtof:
101101 and a, $1F
102102.L.round_up:
103103.L.round_down:
104- call __llshru
104+ ; BC:UDE:UHL >>= 29
105+ call __llshru_nz
105106 ; B, C, and UDE are zero here
106107 or a, a
107108 jr z, .L.no_round
@@ -192,7 +193,7 @@ __dtof:
192193 and a, $0F
193194 or a, $10
194195
195- call __lshru
196+ call __lshru_nz
196197 xor a, a ; subnormal exponent
197198 ; HL = BC >> 1
198199 scf
@@ -216,5 +217,5 @@ __dtof:
216217
217218 .extern __lland
218219 .extern __llcmpzero
219- .extern __llshru
220- .extern __lshru
220+ .extern __llshru_nz
221+ .extern __lshru_nz
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ __dtoull:
5050 ld l, a
5151 ex (sp), hl
5252 ; shift is non-zero and [1, 11] in the non-UB case
53- call c, __llshl
53+ call c, __llshl_nz
5454 jr .finish
5555.shift_right:
5656 ; A is [-1, -52]
@@ -85,5 +85,5 @@ __dtoull:
8585 jr .finish_zero_or_one
8686
8787 .extern __llneg
88- .extern __llshl
88+ .extern __llshl_nz
8989 .extern __llshru
Original file line number Diff line number Diff line change @@ -71,9 +71,9 @@ __ftod:
7171.L.subnormal:
7272 ; since this is subnormal, the LSB of the exponent is already zero
7373 call __ictlz
74- ld c, a
74+ ld c, a ; A is [1, 23]
7575 ; shift until the MSB of the mantissa is the LSB of the exponent
76- call __ishl
76+ call __ishl_nz
7777 ; (Float64_bias - Float32_bias) = $0380
7878 ; expon = (Float64_bias - Float32_bias) - clz_result
7979 add hl, hl
@@ -101,4 +101,4 @@ __ftod:
101101 jr .L.shift_28
102102
103103 .extern __ictlz
104- .extern __ishl
104+ .extern __ishl_nz
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ __lltod:
6969 pop bc
7070
7171 ex (sp), hl ; (SP) = shift
72- call __llshru
72+ call __llshru_nz
7373 add a, 51 - 1 ; compensate for the implicit mantissa bit
7474
7575 ; BC/exponent = [$434*, $43E*]
@@ -174,7 +174,7 @@ __ltod:
174174 .extern __lctlz
175175 .extern __llctlz
176176 .extern __llshl
177- .extern __llshru
177+ .extern __llshru_nz
178178 .extern __llneg
179179 .extern __lladd_1
180180 .extern ___fe_cur_env
Original file line number Diff line number Diff line change @@ -54,10 +54,10 @@ _frexp:
5454 add hl, de
5555 inc hl ; restore HL
5656 jr nc, .L.ret_zero
57- ; input: HL output: A
57+ ; input: HL output: A in [1, 23]
5858 call __ictlz
5959 ld c, a
60- call __ishl
60+ call __ishl_nz
6161 ld (iy + 3), hl
6262 sub a, 131 ; (127 + 3) + 1? idk where this magic number comes from
6363 cpl
@@ -69,6 +69,6 @@ _frexp:
6969 jr .L.ret_subnormal
7070
7171 .extern __ictlz
72- .extern __ishl
72+ .extern __ishl_nz
7373
7474.endif
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ _truncf:
3131 neg
3232 ld d, c ; store C
3333 ld c, a
34- call __ishl
34+ call __ishl_nz
3535 ld c, d ; restore C
3636 jp __iand
3737
@@ -49,5 +49,5 @@ _truncf:
4949 sbc hl, hl
5050 ret
5151
52- .extern __ishl
52+ .extern __ishl_nz
5353 .extern __iand
You can’t perform that action at this time.
0 commit comments