mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
more efficient match, avoiding strings
This commit is contained in:
@@ -370,7 +370,7 @@ function get_prefix_length( range )
|
||||
last = ipOps.ip_to_bin(last)
|
||||
|
||||
for pos = 1, #first do
|
||||
if first:sub(pos, pos) ~= last:sub(pos, pos) then
|
||||
if first:byte(pos) ~= last:byte(pos) then
|
||||
return pos - 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -438,7 +438,7 @@ function get_prefix_length( range )
|
||||
last = ipOps.ip_to_bin(last)
|
||||
|
||||
for pos = 1, #first do
|
||||
if first:sub(pos, pos) ~= last:sub(pos, pos) then
|
||||
if first:byte(pos) ~= last:byte(pos) then
|
||||
return pos - 1
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user