Post
by Saman » Wed May 30, 2012 2:56 pm
Exactly as Herath stated, you need to use bit wise AND (&) and OR (|) operators to filter out releveant information from that.
I'll give you an example. Say that one user is trying to access 1st store while his access signature is 34. As Herath stated, you check if (signature & 1) is true or false. If true, that means this user has access, if not, user doesn't have access.
So the common form is (signature & x) where x is the bit-wise location of the store as below.
0000 0000 0000 0001 - 1st store
0000 0000 0000 0010 - 2nd store
0000 0000 0000 0100 - 3rd store
0000 0000 0000 1000 - 4th store
0000 0000 0001 0000 - 5th store
....
...
Computationally, you can check it as if (signature & (1 << (store_no - 1))).