diff options
author | Asbjørn Sloth Tønnesen <ast@2e8.dk> | 2019-07-16 19:29:14 +0000 |
---|---|---|
committer | Asbjørn Sloth Tønnesen <ast@2e8.dk> | 2019-07-16 19:29:14 +0000 |
commit | 079c662ce5ab285304b3ee877890065ae864ea0c (patch) | |
tree | 948fc4acde1edf619bbfe0d1a1344515c355d8c5 /lua/inet/init.lua | |
parent | a22e99c79588d6b7d8620ed061925230427e1635 (diff) | |
download | lua-inet-079c662ce5ab285304b3ee877890065ae864ea0c.tar.gz lua-inet-079c662ce5ab285304b3ee877890065ae864ea0c.tar.xz lua-inet-079c662ce5ab285304b3ee877890065ae864ea0c.zip |
inet6: __mul: bugfix, need more tests for edge cases
Signed-off-by: Asbjørn Sloth Tønnesen <ast@2e8.dk>
Diffstat (limited to 'lua/inet/init.lua')
-rw-r--r-- | lua/inet/init.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/inet/init.lua b/lua/inet/init.lua index ef8c5f2..b89515e 100644 --- a/lua/inet/init.lua +++ b/lua/inet/init.lua @@ -647,6 +647,7 @@ end function inet6:__mul(n) local new = self:clone() local mask = new.mask + if mask == 0 then return nil, 'unable to perform operation' end local pcs = new.pcs local netbitoverflow = mask % 16 local netbitremainder = (128-mask) % 16 @@ -662,7 +663,7 @@ function inet6:__mul(n) local shiftet = lshift(n, netbitremainder) local high_shift = rshift(shiftet, 16) local low_shift = band(shiftet, 0xffff) - --print(p, netbitoverflow, hex(shiftet), hex(high_shift), hex(low_shift)) + --print(p, netbitoverflow, tohex(shiftet), tohex(high_shift), tohex(low_shift)) if was_negative then high_shift = -high_shift low_shift = -low_shift |