is there any builtin mod function can be used inside a kernel? I need mod to implement hash function. If not, any suggestion?
It's the same as in C, %: 3 % 2 == 1.
It's not a fast operation, so keep in mind that the modulo of powers of two can be computed much more efficiently as:
x % 2^n == x & (2^n - 1)
From the wikipedia article.
there is also float function floatN fmod(floatN a, floatN b)