MoonGen
 All Files Functions Variables Pages
bitmask.lua File Reference

Bitmask ... More...

Go to the source code of this file.

Functions

function mod createBitMask (size)
 Create a Bitmask The mask is internally built from blocks of 64bit integers. More...
 
function mod linkToArray (bitmasks)
 
function mg_bitMask setN (n)
 sets the first n bits in a bitmask to 1 other bits remain unchanged More...
 
function mg_bitMask clearAll ()
 sets all bits in a bitmask to 0
 
function mg_bitMask setAll ()
 sets all bits in a bitmask to 1
 
function mg_bitMask __index (x)
 Index metamethod for mg_bitMask. More...
 
function mg_bitMask __newindex (x, y)
 Newindex metamethod for mg_bitMask. More...
 
function mod band (mask1, mask2, result)
 Bitwise and. More...
 
function mod bor (mask1, mask2, result)
 Bitwise or. More...
 
function mod bxor (mask1, mask2, result)
 Bitwise xor. More...
 
function mod bnot (mask, result)
 Bitwise not. More...
 

Detailed Description

Bitmask ...

Todo:
TODO docu

Definition in file bitmask.lua.

Function Documentation

function mg_bitMask __index ( )

Index metamethod for mg_bitMask.

Parameters
xBit index. Index starts at 1 according to the LUA standard (1 indexes the first bit in the bitmask)
Returns
For numeric indices: true, when corresponding bit is 1, false otherwise.
function mg_bitMask __newindex ( ,
 
)

Newindex metamethod for mg_bitMask.

Parameters
xBit index. Index starts at 1 according to the LUA standard (1 indexes the first bit in the bitmask)
function mod band ( mask1  ,
mask2  ,
result   
)

Bitwise and.

Parameters
mask1
mask2
resultresult = mask1 band mask2
function mod bnot ( mask  ,
result   
)

Bitwise not.

Parameters
mask
resultresult = not mask
function mod bor ( mask1  ,
mask2  ,
result   
)

Bitwise or.

Parameters
mask1
mask2
resultresult = mask1 bor mask2
function mod bxor ( mask1  ,
mask2  ,
result   
)

Bitwise xor.

Parameters
mask1
mask2
resultresult = bask1 bxor mask2
function mod createBitMask ( size  )

Create a Bitmask The mask is internally built from blocks of 64bit integers.

Hence a Bitmask of a size <<64 yields significant overhead

Parameters
sizeSize of the bitmask in number of bits
Returns
Wrapper table around the bitmask
function mod linkToArray ( bitmasks  )
Parameters
bitmasks
Todo:
TODO: think of a better solution - meh
function mg_bitMask setN ( n  )

sets the first n bits in a bitmask to 1 other bits remain unchanged

Parameters
n