a, b and c both are 64 bit integers, c is arbitary number, may not be in power of 2.
but a * b will generate a 128 bit intermediate integers which will overflow. So I believe there is an algorithm to deal with such problem
I'm not sure if this is correct...I just read some websites talking...
I want to write a C/C++ program and encounter a problem.If I have three 64 bit numbers and need to manipulate
"a * b mod c"
Is there any well-known, efficient and simple algorithm to implement it?
I only know it can be calculated sth. like this..
__int64 a, b, c
a = x1 * 2^32 + x0
b =...
I want to write a C/C++ program and encounter a problem.If I have three 64 bit numbers and need to manipulate
"a * b mod c"
Is there any well-known, efficient and simple algorithm to implement it?
I only know it can be calculated sth. like this..
__int64 a, b, c
a = x1 * 2^32 + x0
b =...