I use OpenCL for GPGPU programming, but unfortunately there's no native 256 bit integer support. I decided to have 256 bit integer splitted in four 64bit integers. Pretty good solution for basic operations, but how can I get modulo of them?
I need to do this:
(uint256) % (uint256)
But with OpenCL, I can only have this:
[ (uint64), (uint64), (uint64), (uint64) ] % [ (uint64), (uint64), (uint64), (uint64) ]
So how can I achieve that? What algorithm should I use, and the most important - what is the easiest to implement?
P.S. I need that for public key cryptography.
EDIT: I don't have neither addition nor subtraction implemented.