title: Bit Manipulation Delphi in XML - Bitwise
body: <p>I am a student in high school and I am currently learning in Delphi XE3. We are learning about BIT manipulation. We have an assignment and while I have read a lot on the subject and understand the entire process of storing information in Bits and SHL/SHR I am having difficulty understanding how to do this process in Delphi.</p>
  
  <p>The assignment is as follows:</p>
  
  <pre><code>Decimal        Hexidecimal    Binary
  1              0x0001         0000000000000001
  2              0x0002         0000000000000010
  4              0x0004         0000000000000100
  </code></pre>
  
  <p>Passing an integer value in an XML file to identify the options set. For example. If I wanted to send option 1 and option 2, I would add 1+2=3. I would send 3 as the number to specify that options 1 and 2 are true.</p>
  
  <p>On the client the binary value would be 0000000000000011 = 3</p>
  
  <p>From what I have read I need to use a mask but I do not understand how to do this. How would do I use masks in Delphi ot obtain the individual values which would be True or False.</p>
  
  <p>I tried doing this in a regular Integer variable but it always gets treated as an Integer and the result is very strange. If I convert the integer to a binary string representation and I iterate thru the characters the result is correct but I am assuming that I should not be doing this with strings. Any help or an example would be greatly appreciated. Thank you.</p>