lambdaworks-math 0.10.0

Modular math library for cryptography
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef UTILS_H
#define UTILS_H

/// Reverses the `log2(size)` first bits of `i`
__device__ unsigned reverse_index(unsigned i, unsigned size)
{
    if (size == 1)
    { // TODO: replace this statement with an alternative solution.
        return i;
    }
    else
    {
        return __brev(i) >> (__clz(size) + 1);
    }
}

#endif // UTILS_H