Skip to content

Commit 8e98366

Browse files
committed
use fastmath to constant fold to fmul in conversion
1 parent 867d088 commit 8e98366

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/normed.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end
4444

4545
@inline convert(::Type{N0f16}, x::N0f8) = reinterpret(N0f16, convert(UInt16, 0x0101*reinterpret(x)))
4646
@inline function _convert{U<:Normed,T}(::Type{U}, ::Type{T}, x)
47-
y = round(widen1(rawone(U))*x)
47+
y = @fastmath round(widen1(rawone(U))*x)
4848
(0 <= y) & (y <= typemax(T)) || throw_converterror(U, x)
4949
U(_unsafe_trunc(T, y), 0)
5050
end
@@ -63,7 +63,7 @@ float(x::Normed) = convert(floattype(x), x)
6363

6464
convert(::Type{BigFloat}, x::Normed) = reinterpret(x)*(1/BigFloat(rawone(x)))
6565
@inline function convert{T<:AbstractFloat}(::Type{T}, x::Normed)
66-
y = reinterpret(x)*(one(rawtype(x))/convert(T, rawone(x)))
66+
y = @fastmath reinterpret(x)*(one(rawtype(x))/convert(T, rawone(x)))
6767
convert(T, y) # needed for types like Float16 which promote arithmetic to Float32
6868
end
6969
convert(::Type{Bool}, x::Normed) = x == zero(x) ? false : true

0 commit comments

Comments
 (0)