mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 08:46:45 +00:00
more efficient match, avoiding strings
This commit is contained in:
parent
59efc272ec
commit
57a17415b7
2 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue