Skip to content

Commit

Permalink
Fix StackOverflow error with >>, << and >>> on Bool and Unsigned
Browse files Browse the repository at this point in the history
Error was triggered e.g. by false >> 0x01.
  • Loading branch information
nalimilan committed Jun 17, 2016
1 parent 858371f commit f143ae0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/bool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ typemax(::Type{Bool}) = true
(|)(x::Bool, y::Bool) = box(Bool,or_int(unbox(Bool,x),unbox(Bool,y)))
($)(x::Bool, y::Bool) = (x!=y)

>>(x::Bool, c::Unsigned) = Int(x) >> c
<<(x::Bool, c::Unsigned) = Int(x) << c
>>>(x::Bool, c::Unsigned) = Int(x) >>> c

signbit(x::Bool) = false
sign(x::Bool) = x
abs(x::Bool) = x
Expand Down

0 comments on commit f143ae0

Please sign in to comment.