Skip to content

Commit

Permalink
restore performance of integer shift operators.
Browse files Browse the repository at this point in the history
These were calling convert, which generally works, but is slow as
it checks the conversion from Int to Int32, somewhat unnecessarily.
  • Loading branch information
StefanKarpinski committed May 5, 2015
1 parent f938b70 commit da0dc58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ const .≠ = .!=
<<(x,y::Int32) = no_op_err("<<", typeof(x))
>>(x,y::Int32) = no_op_err(">>", typeof(x))
>>>(x,y::Int32) = no_op_err(">>>", typeof(x))
<<(x,y::Integer) = x << convert(Int32,y)
>>(x,y::Integer) = x >> convert(Int32,y)
>>>(x,y::Integer) = x >>> convert(Int32,y)
<<(x,y::Integer) = x << (y % Int32)
>>(x,y::Integer) = x >> (y % Int32)
>>>(x,y::Integer) = x >>> (y % Int32)

# fallback div, fld, and cld implementations
# NOTE: C89 fmod() and x87 FPREM implicitly provide truncating float division,
Expand Down

0 comments on commit da0dc58

Please sign in to comment.