Bug related to SA1020

Jul 29, 2011 at 12:38 AM

This gets the SA1020 warnings for these two lines

 for (ps += count, pd += count; count != 0; count--)      
 *--pd = *--ps;
 
---

Below is the code

    public static void Copy(void* src, void* dst, int count)
    {
      byte* ps = (byte*)src;
      byte* pd = (byte*)dst;
      if (ps > pd)
      {
        for (; count != 0; count--)
        {
          *pd++ = *ps++;
        }
      }
      else
      {
        if (ps < pd)
        {
          for (ps += count, pd += count; count != 0; count--)
          {
            *--pd = *--ps;
          }
        }
      }
    }