ocl: fix invalid usage of alignSize (n is not a power of 2), added roundUp

This commit is contained in:
Alexander Alekhin
2013-09-18 01:14:41 +04:00
parent 6fae07ba88
commit f1b5cbc8fe
2 changed files with 14 additions and 3 deletions

View File

@@ -339,6 +339,7 @@ template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_
*/
static inline size_t alignSize(size_t sz, int n)
{
assert((n & (n - 1)) == 0); // n is a power of 2
return (sz + n-1) & -n;
}