Just use a bitwise-and. In C/C++, this would be: if (flags & 1) { // Bit zero is set. } if (flags & 2) { // Bit one is set.
} if (flags & 4) { // Bit two is set. } For production goodness, use symbolic names for the flag masks instead of the magic numbers, 1, 2, 4, 8, etc If the flags are homogeneous in some way (e.g. , they represent ten spatial dimensions in some geometry problem) and the code to handle each case is the same, you can use a loop: for (int f = 0; f } }.
Just use a bitwise-and. In C/C++, this would be: if (flags & 1) { // Bit zero is set. } if (flags & 2) { // Bit one is set.
} if (flags & 4) { // Bit two is set. } ... For production goodness, use symbolic names for the flag masks instead of the magic numbers, 1, 2, 4, 8, etc. If the flags are homogeneous in some way (e.g. , they represent ten spatial dimensions in some geometry problem) and the code to handle each case is the same, you can use a loop: for (int f = 0; f.
WOW! Very quick! I wanted to accept your answer right away, but apparently I should wait for at least 9 minutes.
Thanks really. – Majid Fouladpour Apr 25 '10 at 7:24 +1 was typing something similar but you was faster ;) – RC. Apr 25 '10 at 7:28.
You could get a number that has the n-th bit set and AND it with your number. If the result is zero your number didn't have the bit set. Otherwise, it did.
Look here, also.
You can use a bitwise and: 10 & 2^1 is true because 10 = 1010b ^ 1 8 & 2^1 is false because 8 = 1000b ^ 0 10 & 2^3 is true because 10 = 1010b ^ 1.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.