Advertisement
Guest User

in-place interleave, memmove and split

a guest
Feb 8th, 2011
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. void deinterleave_mm_split(int *a, int len)
  2. {
  3.     if (0 == len % 4)
  4.     {
  5.         deinterleave_mm_split(&a[0], len/2);
  6.         deinterleave_mm_split(&a[len/2], len/2);
  7.         for (int i = len/4; i < len/2; i++)
  8.         {
  9.             int t = a[i];
  10.             a[i] = a[i+len/4];
  11.             a[i+len/4] = t;
  12.         }
  13.     }
  14.     else
  15.     {
  16.         deinterleave_mm(a, len);
  17.     }
  18. }
  19.  
  20. void interleave_mm_split(int *a, int len)
  21. {
  22.     if (0 == len % 4)
  23.     {
  24.         for (int i = len/4; i < len/2; i++)
  25.         {
  26.             int t = a[i];
  27.             a[i] = a[i+len/4];
  28.             a[i+len/4] = t;
  29.         }
  30.         interleave_mm_split(&a[0], len/2);
  31.         interleave_mm_split(&a[len/2], len/2);
  32.     }
  33.     else
  34.     {
  35.         interleave_mm(a, len);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement