title: c# compare byte arrays
body: <p>I'm trying to compare 2 byte array using pointers.
  I treat the byte arrays as int pointer to run things faster(compare 4 bytes together).</p>
  
  <pre><code>    public static bool DoBuffersEqual(byte[] first, byte[] second)
      {
          unsafe
          {
              fixed (byte* pfirst = first, psecond = second)
              {
                  int* intfirst = (int*)pfirst;
                  int* intsecond = (int*)psecond;
  
                  for (int i = 0; i &lt; first.Length / 4; i++)
                  {
                      if ((intfirst + i) != (intsecond + i))
                          return false;
                  }
              }
          }
          return true;
      }
      private void Form1_Load(object sender, EventArgs e)
      {
          byte[] arr1 = new byte[4000];
          byte[] arr2 = new byte[4000];
          for (int i = 0; i &lt; arr1.Length; i++)
          {
              arr1[i] = 100;
              arr2[i] = 100;
          }
          bool res = DoBuffersEqual(arr1, arr2);
          Console.WriteLine(res);
      }
  </code></pre>
  
  <p>For some reason i'm getting  <strong>False</strong> result after calling this function...</p>
  
  <p>Does anybody have any idea what's wrong here?</p>
  
  <p>Thanks in advance!</p>