F
F
Fiskers2016-12-20 20:02:19
GPGPU
Fiskers, 2016-12-20 20:02:19

Does the Nvidia CUDA libraries have a bitwise shift function, like in C++ _lrotl and _lrotr from stdlib.h?

If there are none, maybe there is an implementation (source) of such functions in C\C++?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2016-12-21
@Fiskers

What is the difficulty?

uint32_t lrotl(uint32_t v, unsigned s)
{
    s &= sizeof(v) * 8 - 1;
    if (s)
        return (v << s) | (v >> (sizeof(v) * 8 - s));
    else
        return v;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question