blob: 89c992bebdf7aa36478d30743c2ceadc2c56317c [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001local m = {}
2
3local getAlignSize
4if _VERSION == "Lua 5.3" then
5 getAlignSize = function(k, size)
6 return ((~k) + 1) & (size - 1)
7 end
8else
9 getAlignSize = function(self, size, additionalBytes)
10 local alignsize = bit32.bnot(#self.bytes-self:Head() + additionalBytes) + 1
11 return bit32.band(alignsize,(size - 1))
12 end
13end
14
15m.GetAlignSize = getAlignSize
16
17return m