File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -13,28 +13,31 @@ __dtoull:
1313 jr z, .zero_or_one
1414 bit 7, b
1515 push af
16- res 7, b
16+ ; res 7, b ; not needed since this bit is shifted out later on
1717 push hl
1818 ; -((Float64_mant_bits + Float64_bias) << 4)
19- ld hl, $FFC010 ; -16368 ; -$3FF0
19+ ; ld hl, $FFC010 ; -16368 ; -$3FF0
2020
21- ; clears the exponent field without touching the mantissa
22- ; sets the LSB of the exponent since x is normalized
23- ld a, c
24- or a, l ; or a, $10
25- and a, $1F
26-
27- add hl, bc
21+ ; extract the exponent
22+ ld h, b
23+ ld l, c
2824 ; HL <<= 4
2925 add hl, hl
3026 add hl, hl
3127 add hl, hl
3228 add hl, hl
29+ ; inc hl
3330
31+ ; clears the exponent field without touching the mantissa
32+ ; sets the LSB of the exponent since x is normalized
33+ ld a, c
34+ or a, $10
35+ and a, $1F
3436 ld c, a
3537 ld b, 0
36- ld a, h
37- sub a, 52 + 1 ; float64 mantissa bits
38+
39+ ld a, h ; expon
40+ sub a, 52 + 1 - 1 ; float64 mantissa bits + CPL trick - inc HL
3841 jr c, .shift_right
3942 ; shift_left
4043 ; expon >= 52 or [52, 63]
You can’t perform that action at this time.
0 commit comments