more efficient match, avoiding strings

This commit is contained in:
nnposter 2018-08-18 01:00:16 +00:00
parent 59efc272ec
commit 57a17415b7
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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