File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -48,25 +48,24 @@ __ltod:
4848 private __ltod.hijack
4949__ltod.hijack:
5050 call __lctlz
51- cp a, 32
51+ inc.s bc ; clear UBC
52+ ld b, a ; <<= 8
53+ xor a, $20 ; turns 32 into zero and clears carry flag
5254 jr z, .zero
5355 ; clears the MSB since the float will be normalized
5456 ; x <<= clz_result + 1; /* shift by 32 is UB */
5557if 0
5658 ; calculate the exponent
5759 push hl
5860 ; 1023 + 31 = 1054 = 0x41E
59- inc.s bc
60- or a, a
61- ld b, a ; <<= 8
6261 ld hl, $041E00
6362 ld c, l ; ld c, 0
6463 sbc hl, bc
6564 ld l, e ; (expon16 << (16 + 24)) | (mant48)
6665 ex de, hl
6766 pop hl
6867
69- ld b, a
68+ ; ld b, a
7069 inc b
7170 ld a, e
7271.loop32: ; shift by 32 is not UB here!
7877 ; calculate the exponent
7978 push hl
8079 ; 1023 + 31 = 1054 = 0x41E
81- inc.s bc
82- or a, a
83- ld b, a ; <<= 8
8480 ld hl, $041E00
8581 ld c, l ; ld c, 0
8682 sbc hl, bc
8783 ld l, e ; (expon16 << (16 + 24)) | (mant48)
8884 ex de, hl
8985
86+ ld l, b
9087 pop bc
91- ld l, a
9288 ld a, e
9389 call __lshl
9490 push bc
@@ -112,7 +108,7 @@ end if
112108 ret ; negative
113109
114110.zero:
115- sbc hl, hl
111+ ; E:UHL and A are zero
116112 ex de, hl
117113 sbc hl, hl
118114 ld b, e
You can’t perform that action at this time.
0 commit comments