Hi Thomas, tried to email you but could not directly. Since you helped me with external functions [in an eallier support post for those that are looking] (to overcome a multiplication overflow when the overflow is desired) I have added a few more functions to my external "C" DLL, which makes me love VP even more--seriously. So a wish list predicate if you get the chance sometime in the future:
In "pfc\memory\bit.cl" you have:
Code: Select all
predicates
trailingZeroBits : (unsigned Value) -> unsigned Count.
% @short Calculating the number of consecutive low-order zeros
% @end
which is exactly what I needed, but it only supports unsigned, so I was using trailingZeroBits on the LOW/HI 32 bits and using mkUnsigned64 to put it back together to handle 64-bit unsigned integers. It would be great to have a 64 bit version of trailingZeroBits. In the interim, I added the following to my external "C" DLL for performance:
unsigned char APIENTRY Ls1b(UINT64 bits, UINT64* bitsOut, unsigned char* index)
{
unsigned long uint64 = 0;
unsigned char result = _BitScanForward64(&uint64, bits);
*index = (unsigned char)uint64;
if(bitsOut!=nullptr)
*bitsOut = bits ^ (1ULL << *index);
return result;
}
PS: The _BitScanForward64 is the relevant function and is a compiler intrinsic function in Visual Studio C++.
Thanks for all your hard work!