Skip to content

Commit

Permalink
Fix Style/BitwisePredicate RuboCop offense
Browse files Browse the repository at this point in the history
  • Loading branch information
mvz committed Nov 10, 2024
1 parent d98df76 commit 21c6f2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/aruba/contracts/is_power_of_two.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class IsPowerOfTwo
def self.valid?(value)
# explanation for algorithm can be found here:
# http://www.exploringbinary.com/ten-ways-to-check-if-an-integer-is-a-power-of-two-in-c/
value.positive? && (value & (value - 1)).zero?
value.positive? && value.nobits?(value - 1)
rescue StandardError
false
end
Expand Down

0 comments on commit 21c6f2e

Please sign in to comment.