13.07.2015 Views

Analysis of Structures - Baustatik-Info-Server

Analysis of Structures - Baustatik-Info-Server

Analysis of Structures - Baustatik-Info-Server

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3. OPERATORS Page 17>>> a = 27563>>> "%X" %a’6BAB’>>>The binary number representation is easily available from the hexadecimal representation, if we knowthe binary representation <strong>of</strong> the hexadecimal digits 4 .6 16 = 6 10 = 4 + 2 = 0110 2A 16 = 10 10 = 8 + 2+ = 1010 2B 16 = 11 10 = 8 + 2 + 1 = 1011 2So we get assembling the binary digits <strong>of</strong> 6BAB the following bit sequence.27563 10 = 6BAB 16 = 0110|1011|1010|1011 2 (2.2)If we now want to set the highest bit <strong>of</strong> the discussed number, we can use the bitwise OR operator | (seesection 2.3.3). A number with only the highest bit set we can obtain by shifting the first bit to the desiredposition within the 2 bytes, i.e. we shift the bit 15 times. Now we can see that we get a hexadecimalnumber with only the highest digit non vanishing. Within the digit <strong>of</strong> 8 the forth bit is set, which is thehighest <strong>of</strong> a have byte 5 .>>> b = 1>>> b = b> b32768>>> "%X" % b’8000’If we now want to set the highest bit <strong>of</strong> our original number 27563, we simple can overlay it with the lastnumber 8000.>>> a = 27563>>> b = a | (1> b60331>>> "%X" % b’EBAB’After having set the highest bit, we see that the decimal number has changed totally. However thehexadecimal number only changes in the first digit. Instead <strong>of</strong> 6 we have now E. And E is representedbinary withE 16 = 14 10 = 8 + 4 + 2 = 1110 2so we get60331 10 = EBAB 16 = 1110|1011|1010|1011 2 (2.3)4 The index <strong>of</strong> the example’s numbers represent the base <strong>of</strong> the numbering system.5 A half byte is also called nibble.2.12.2011

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!