* luci/libs: In luci.ip: __array16() does assert() already, so drop redundant sanity checks in add() and sub()

This commit is contained in:
Jo-Philipp Wich 2008-08-09 18:59:37 +00:00
parent ba298a020b
commit 2787a7f688

View file

@ -551,7 +551,6 @@ function cidr.add( self, amount, inplace )
local data = { unpack(self[2]) }
local shorts = __array16( amount, self[1] )
if shorts then
for pos = #data, 1, -1 do
local add = ( #shorts > 0 ) and table.remove( shorts, #shorts ) or 0
if ( data[pos] + add ) > 0xFFFF then
@ -565,7 +564,6 @@ function cidr.add( self, amount, inplace )
data[pos] = data[pos] + add
end
end
end
if inplace then
self[2] = data
@ -584,7 +582,6 @@ function cidr.sub( self, amount, inplace )
local data = { unpack(self[2]) }
local shorts = __array16( amount, self[1] )
if shorts then
for pos = #data, 1, -1 do
local sub = ( #shorts > 0 ) and table.remove( shorts, #shorts ) or 0
if ( data[pos] - sub ) < 0 then
@ -598,7 +595,6 @@ function cidr.sub( self, amount, inplace )
data[pos] = data[pos] - sub
end
end
end
if inplace then
self[2] = data