summaryrefslogtreecommitdiff
path: root/lib/ipaddress/ipv4.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ipaddress/ipv4.rb')
-rw-r--r--lib/ipaddress/ipv4.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/ipaddress/ipv4.rb b/lib/ipaddress/ipv4.rb
index 6437810..fc2976a 100644
--- a/lib/ipaddress/ipv4.rb
+++ b/lib/ipaddress/ipv4.rb
@@ -1026,12 +1026,9 @@ module IPAddress;
#
private
+ # Tweaked to remove the #upto(32)
def newprefix(num)
- num.upto(32) do |i|
- if (a = Math::log2(i).to_i) == Math::log2(i)
- return @prefix + a
- end
- end
+ return @prefix + (Math::log2(num).to_i)
end
def sum_first_found(arr)