<page xmlns="http://projectmallard.org/1.0/"
      type="guide"
      id="mode-programming">

  <info>
      <link type="guide" xref="index#number"/>
  </info>

      <title>Programming Mode</title>

  <p>
  <gui style="menuitem">Programming mode</gui> provides the tools required for common mathematical operations in software development. For example, programming mode makes math on hexadecimal numbers very easy. It also supports common <link xref="boolean">bitwise operators</link> like <gui>NOT</gui>, <gui>AND</gui>, <gui>OR</gui>, etc. A binary view for numbers up to 64 bits long is displayed, where the user can manually toggle each bit using the mouse cursor.
  </p>
  <p>
  Additionally, bit-shifting operations are possible by using the <gui>≪</gui>, <gui>≫</gui> and <gui>⋙</gui> buttons. <link xref="modulus">Modulo arithmetic</link> can be accomplished using the <gui>mod</gui> button.
  </p>
  <p>
  The default word size for bitwise, two’s complement, and swap endianness functions can be changed both in the <gui style="menuitem">Preferences</gui> menu, or by using the word size button in the bottom of the keypad while in programming mode. This will affect how results from these functions are shown. For example, here we show the two’s complement of the number 6B in 64 bit and 16 bit word sizes:
  </p>
    <example>
    <p>
    64 bit:
    </p>
    <p>
    twos 6B
    </p>
    <p>
    FFFFFFFFFFFFFF95
    </p>
    <p>
    16 bit:
    </p>
    <p>
    twos 6B
    </p>
    <p>
    FF95
    </p>
    </example>
    <note style="warning">
    <p>Attempting to enter a larger number than will fit in the selected word size will result in an Overflow error.</p>
    </note>

</page>
