MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / inside2d

Function inside2d

src/library/blas/fill.cc:29–47  ·  view source on GitHub ↗

Return true if the area starting from pint (x,y) and of size (w,h) is within the array of size d1 x d2

Source from the content-addressed store, hash-verified

27// Return true if the area starting from pint (x,y) and of size (w,h) is
28// within the array of size d1 x d2
29static int inside2d( size_t d1, size_t d2, int x, int y, size_t w, size_t h )
30{
31 // Very very large dimensions are likely a bug
32 size_t MAXDIM = ((size_t)INT_MAX) ;
33 if ( d1 >= MAXDIM ) return 0 ;
34 if ( d2 >= MAXDIM ) return 0 ;
35 if ( w >= MAXDIM ) return 0 ;
36 if ( h >= MAXDIM ) return 0 ;
37
38 if ( x < 0 || x >= (int)d1 ) return 0 ;
39 size_t max_w = (size_t)(d1-x) ;
40 if ( w > max_w ) return 0 ;
41
42 if ( y < 0 || y >= (int)d2 ) return 0 ;
43 size_t max_h = (size_t)(d2-y) ;
44 if ( h > max_h ) return 0 ;
45
46 return 1 ;
47}
48
49extern "C"
50clblasStatus clblasFillVectorAsync( size_t nb_elem,

Callers 1

clblasFillSubMatrixAsyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected