Merge pull request #1673 from Citadel-Station-13/upstream-merge-28567

[MIRROR] Refactors PDA cartridge permissions
This commit is contained in:
LetterJay
2017-06-27 06:14:42 -05:00
committed by GitHub
6 changed files with 93 additions and 109 deletions
+7
View File
@@ -1417,3 +1417,10 @@ GLOBAL_PROTECT(valid_HTTPSGet)
mob_occupant = brain.brainmob
return mob_occupant
//counts the number of bits in Byond's 16-bit width field
//in constant time and memory!
/proc/BitCount(bitfield)
var/temp = bitfield - ((bitfield>>1)&46811) - ((bitfield>>2)&37449) //0133333 and 0111111 respectively
temp = ((temp + (temp>>3))&29127) % 63 //070707
return temp