Uhm. I feel dumb asking this question, 'cos it's prolly got a simple solution.
I've got a hex number (let's call it hx) that stores a flag. and values like:
0x01 = Is Male
0x02 = Is Employee
0x04 = Has Drivers License
0x08 = Is Smoker
If hx = 0x0A it means:
A) The person is Not Male
B) The person is a Employee
C) The person does not have a drivers license
D) The person is a smoker
because 0x0A = 0x02 + 0x08. No other combination of those would give you 0x0A.
and if hx = 0x07 it means:
A) The person is Male
B) The person is a Employee
C) The person does have a drivers license
D) The person is Not a smoker
because 0x07 = 0x01 + 0x02 + 0x04.
What I want to know is how I can calculate which of those values makes up hx.
