From 21c6f2ec585c6c78174d25c5a75b2fb5de139d2c Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 10 Nov 2024 11:18:18 +0100 Subject: [PATCH] Fix Style/BitwisePredicate RuboCop offense --- lib/aruba/contracts/is_power_of_two.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aruba/contracts/is_power_of_two.rb b/lib/aruba/contracts/is_power_of_two.rb index adfd739e..6d0a449a 100644 --- a/lib/aruba/contracts/is_power_of_two.rb +++ b/lib/aruba/contracts/is_power_of_two.rb @@ -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