Return true if the area starting from pint (x,y) and of size (w,h) is within the array of size d1 x d2
| 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 |
| 29 | static 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 | |
| 49 | extern "C" |
| 50 | clblasStatus clblasFillVectorAsync( size_t nb_elem, |
no outgoing calls
no test coverage detected