Commit 9e71f485 authored by Mike Gibson's avatar Mike Gibson
Browse files

added bit writting function to C++ side of openCL implementation.

parent 75be44fa
......@@ -411,7 +411,24 @@ inline _caUnsigned computeStride(_caUnsigned size, _caUnsigned alignment=32)
return alignment * ((size + alignment - 1)/ alignment);
}
//! Write the value to store in the selected bits of the given buffer
//! value. The given buffer value with the bits set is retunerd by the
//! method.
inline _caState caWriteBitsState(_caState value, _caState buffer, int start, int stop)
{
int mask = 0;
int bits = 0;
int b = 0;
int s = 0;
for (b = 0, s = start; s<stop;b++, s++)
{
mask |= (1 << s);
bits |= (((1 << b)&value) >> b) << s;
buffer = (buffer&(~mask)) ^ bits;
}
return buffer;
}
#endif // _CAAPI2D_HPP_
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment