Skip to content

Commit

Permalink
Switch back to using explicit bitwise operations.
Browse files Browse the repository at this point in the history
* Explicit bitwise operations are more understandable than
  the `Integer#allbits?` / `Integer#nobits?` methods.
* Released rubocop-ronin 0.2.7 which disables `Style/BitwisePredicate`.
  • Loading branch information
postmodern committed Nov 21, 2024
1 parent 654b9f2 commit 3893b4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ronin/support/network/ip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def self.extract(text,version=nil,&block)
#
def broadcast?
# NOTE: IPv6 does not have broadcast addresses
ipv4? && @addr.allbits?(0xff) # IPv4: A.B.C.255
ipv4? && (@addr & 0xff) == 0xff
end

#
Expand All @@ -309,7 +309,7 @@ def broadcast?
# # => false
#
def logical?
ipv4? && @addr.nobits?(0xff) # IPv4: A.B.C.0
ipv4? && (@addr & 0xff) == 0x00
end

#
Expand Down

0 comments on commit 3893b4d

Please sign in to comment.