Skip to content

Commit 890d3ef

Browse files
authored
Merge pull request #1 from uniment/uniment-string-macro
run string macros at compile, not runtime
2 parents cde8772 + b038a77 commit 890d3ef

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/type/parse.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
end
88

99
macro df64_str(val::AbstractString)
10-
:(Double64($val))
10+
n = Double64(val)
11+
:(Double64($(n.hi), $(n.lo)))
1112
end
1213

1314
@inline function Double32(str::S) where {S<:AbstractString}
@@ -19,7 +20,8 @@ end
1920
end
2021

2122
macro df32_str(val::AbstractString)
22-
:(Double32($val))
23+
n = Double32(val)
24+
:(Double32($(n.hi), $(n.lo)))
2325
end
2426

2527
@inline function Double16(str::S) where {S<:AbstractString}
@@ -31,7 +33,8 @@ end
3133
end
3234

3335
macro df16_str(val::AbstractString)
34-
:(Double16($val))
36+
n = Double16(val)
37+
:(Double16($(n.hi), $(n.lo)))
3538
end
3639

3740
function tryparse(::Type{DoubleFloat{Float64}}, str::S; base::Int=10) where {S<:AbstractString}

0 commit comments

Comments
 (0)