 
 
 template <int max_half_support>
-__device__
+__device__ __inline__
 void ucs_common(
     cuDoubleComplex mesh[max_half_support * 2 + 1][max_half_support * 2 + 1]
   , double t2
   ){
   __SET_MAP
   double
-      sc = double(max_half_support)
-    , xs = double(x) / sc * t2
-    , ys = double(y) / sc * t2
+      t2_div_sc = t2 / double(max_half_support)
+    , xs = double(x) * t2_div_sc
+    , ys = double(y) * t2_div_sc
     ;
   cuDoubleComplex r2 = make_cuDoubleComplex(xs * xs + ys * ys, 0.0);
 

  mesh[xr][yr] = r2;
}

// test instantiation
template __device__
void ucs_common<256>(cuDoubleComplex mesh[513][513], double t2);


template <int max_half_support>
__device__
void calc_inplace(

  dst[dxr + dyr] = src[xr][yr];
}

extern "C" __global__ void wextract1(
    int supp
  , cuDoubleComplex * dst
  , const cuDoubleComplex src[513][513]
  ){
  cut_out<256,8>(supp, dst, src);
}
