File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -48,25 +48,24 @@ __ltod:
48
48
private __ltod.hijack
49
49
__ltod.hijack:
50
50
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
52
54
jr z, .zero
53
55
; clears the MSB since the float will be normalized
54
56
; x <<= clz_result + 1; /* shift by 32 is UB */
55
57
if 0
56
58
; calculate the exponent
57
59
push hl
58
60
; 1023 + 31 = 1054 = 0x41E
59
- inc.s bc
60
- or a, a
61
- ld b, a ; <<= 8
62
61
ld hl, $041E00
63
62
ld c, l ; ld c, 0
64
63
sbc hl, bc
65
64
ld l, e ; (expon16 << (16 + 24)) | (mant48)
66
65
ex de, hl
67
66
pop hl
68
67
69
- ld b, a
68
+ ; ld b, a
70
69
inc b
71
70
ld a, e
72
71
.loop32: ; shift by 32 is not UB here!
78
77
; calculate the exponent
79
78
push hl
80
79
; 1023 + 31 = 1054 = 0x41E
81
- inc.s bc
82
- or a, a
83
- ld b, a ; <<= 8
84
80
ld hl, $041E00
85
81
ld c, l ; ld c, 0
86
82
sbc hl, bc
87
83
ld l, e ; (expon16 << (16 + 24)) | (mant48)
88
84
ex de, hl
89
85
86
+ ld l, b
90
87
pop bc
91
- ld l, a
92
88
ld a, e
93
89
call __lshl
94
90
push bc
@@ -112,7 +108,7 @@ end if
112
108
ret ; negative
113
109
114
110
.zero:
115
- sbc hl, hl
111
+ ; E:UHL and A are zero
116
112
ex de, hl
117
113
sbc hl, hl
118
114
ld b, e
You can’t perform that action at this time.
0 commit comments