Add bitmask function
This commit is contained in:
parent
4b9e19425a
commit
d90238d45f
2 changed files with 26 additions and 1 deletions
|
@ -378,3 +378,24 @@ string inv2Perms(string inventory, integer iMask)
|
|||
output += "none";
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Usage: i = mask (SET, i, BITMASK)
|
||||
i = mask (FALSE, i, BITMASK)
|
||||
*/
|
||||
integer mask(integer states, integer source, integer mask)
|
||||
{
|
||||
if(states==TOGGLE)
|
||||
{
|
||||
return source ^ mask;
|
||||
}
|
||||
if(states)
|
||||
{
|
||||
source = source | mask;
|
||||
return source;
|
||||
}else {
|
||||
source = source &~ mask;
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,3 +18,7 @@ integer THIRTY_DAYS = 2592000; //(((60*60)*24)*30);
|
|||
|
||||
list g_lCheckboxes = ["□","▣"];
|
||||
list g_lDSRequests;
|
||||
|
||||
integer TOGGLE = 2;
|
||||
integer SET=1;
|
||||
integer UNSET=0;
|
Loading…
Reference in a new issue