Skip to content

Commit da1d837

Browse files
authored
fix type inference regression in Ryu (#37802)
1 parent 0de41e2 commit da1d837

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

base/ryu/utils.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ function pow5invsplit_lookup end
355355
for T in (Float64, Float32, Float16)
356356
e2_max = exponent_max(T) - precision(T) - 2
357357
i_max = log10pow2(e2_max)
358-
table = Any[pow5invsplit(T, i) for i = 0:i_max]
359-
@eval pow5invsplit_lookup(::Type{$T}, i) = @inbounds($table[i+1])
358+
table_sym = Symbol("pow5invsplit_table_", string(T))
359+
@eval const $table_sym = Tuple(Any[pow5invsplit($T, i) for i = 0:$i_max])
360+
@eval pow5invsplit_lookup(::Type{$T}, i) = @inbounds($table_sym[i+1])
360361
end
361362

362363

@@ -382,8 +383,9 @@ function pow5split_lookup end
382383
for T in (Float64, Float32, Float16)
383384
e2_min = 1 - exponent_bias(T) - significand_bits(T) - 2
384385
i_max = 1 - e2_min - log10pow5(-e2_min)
385-
table = Any[pow5split(T, i) for i = 0:i_max]
386-
@eval pow5split_lookup(::Type{$T}, i) = @inbounds($table[i+1])
386+
table_sym = Symbol("pow5split_table_", string(T))
387+
@eval const $table_sym = Tuple(Any[pow5split($T, i) for i = 0:$i_max])
388+
@eval pow5split_lookup(::Type{$T}, i) = @inbounds($table_sym[i+1])
387389
end
388390

389391
const DIGIT_TABLE = UInt8[

0 commit comments

Comments
 (0)