Quote:
Well ... all Powers of 2 except 2^0 are even.
So if a number is odd, it must have Bit 0 (2^0=1) set, so this functions checks for this Bit being set.
|
I don't understand the connection between 0 power and Bit 0? =//
Quote:
1*2^0 = 1*1 = 1
0*2^1 = 0*2 = 0
1*2^2 = 1*4 = 4
In Total: 5
|
How do you convert decimals to binarys?
Quote:
let me try to explain.
like the above example:
32
16
8
4
2
1
this is 65, in your database you have a field called permissionwhatever to store that number (65), and if a usergroup has that value 65 it means they have full permission, each bit represent for a permission. if it's 64, then the value you don't have must be 1, 60 means without 1 and 4 and it cannot be any other number. so that's the way it realizes you don't have what permission.
|
I understand this, thanks...