mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +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)
|
last = ipOps.ip_to_bin(last)
|
||||||
|
|
||||||
for pos = 1, #first do
|
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
|
return pos - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ function get_prefix_length( range )
|
|||||||
last = ipOps.ip_to_bin(last)
|
last = ipOps.ip_to_bin(last)
|
||||||
|
|
||||||
for pos = 1, #first do
|
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
|
return pos - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user