1 /*  Copyright (C) 2003-2007  CAMP
2  *  Please see the accompanying LICENSE file for further information. */
3 
4 #include "bmgs.h"
5 
Z(bmgs_paste)6 void Z(bmgs_paste)(const T* a, const int sizea[3],
7 		   T* b, const int sizeb[3], const int startb[3])
8 {
9   b += startb[2] + (startb[1] + startb[0] * sizeb[1]) * sizeb[2];
10   for (int i0 = 0; i0 < sizea[0]; i0++)
11     {
12       for (int i1 = 0; i1 < sizea[1]; i1++)
13 	{
14 	  memcpy(b, a, sizea[2] * sizeof(T));
15 	  a += sizea[2];
16 	  b += sizeb[2];
17 	}
18       b += sizeb[2] * (sizeb[1] - sizea[1]);
19     }
20 }
21 
Z(bmgs_pastep)22 void Z(bmgs_pastep)(const T* a, const int sizea[3],
23 		    T* b, const int sizeb[3], const int startb[3])
24 {
25   b += startb[2] + (startb[1] + startb[0] * sizeb[1]) * sizeb[2];
26   for (int i0 = 0; i0 < sizea[0]; i0++)
27     {
28       for (int i1 = 0; i1 < sizea[1]; i1++)
29 	{
30 	  for (int i2 = 0; i2 < sizea[2]; i2++)
31 	    b[i2] += *a++;
32 	  b += sizeb[2];
33 	}
34       b += sizeb[2] * (sizeb[1] - sizea[1]);
35     }
36 }
37