title: Unsafe c# code to speed up execution
body: <p>I have code that executes slowly, that I want to speed up through unsafe byte pointer mapped into a long.</p>
  
  <p>The code I want to speed up reads:</p>
  
  <pre><code>public ulong seek(ulong ul)
  {
      ulong v = table[ul &gt;&gt; 56, ul &gt;&gt; 48 &amp; 0xFF] ^ table2[ul &gt;&gt; 40 &amp; 0xFF ul &gt;&gt; 32 &amp;
      0xFF] ^ table[ul &gt;&gt; 24 &amp; 0xFF, ul &gt;&gt; 16 &amp; 0xFF] ^ table2[ul &gt;&gt; 8 &amp; 0xFF, ul &amp;
      0xFF];
      return v;
  }
  </code></pre>
  
  <p>In this code "table" and "table2" are each 256 x 256 tables with random ulong values in them. I would want to modify the above by adding:</p>
  
  <pre><code>v2 = /* Add code to compute the same value using unsafe method, byte pointer arithmetic into the ulong "ul" instead of whole bunch of shifting.*/
  
  Console.WriteLine("Called seek, v={0:X16}, v2={1:X16},
                       result={2}",v, v2, v==v2 ? "Pass" : "Fail"
                   );
  </code></pre>
  
  <p>This way, I can test that both methods are returning the same value, by calling this function repeatedly with random values</p>