Skip to content

Commit

Permalink
Make Num.Bool 9x faster
Browse files Browse the repository at this point in the history
Just use nqp ops to equate self to zero, instead of going
through Numeric.Bool and trying to != against Int 0, using
which would involve .Numerics and .Bridges

Closes #1578 R#1578
  • Loading branch information
zoffixznet committed Feb 28, 2018
1 parent fc643a2 commit 2a42cdb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/Num.pm
Expand Up @@ -19,6 +19,7 @@ my class Num does Real { # declared in BOOTSTRAP
ValueObjAt
)
}
multi method Bool(Num:D:) { nqp::p6bool(nqp::isne_n(self,0e0)) }
method Capture() { die X::Cannot::Capture.new: :what(self) }
method Num() { self }
method Bridge(Num:D:) { self }
Expand Down

0 comments on commit 2a42cdb

Please sign in to comment.