Roman Pearce <rpearcea at cecm.sfu.ca> writes: I'm trying to efficiently compute r = a mod b with -(b-1)/2 <= r <= b/2. Any suggestions? All of my solutions move too much data around. Is each b invvarint over several reductions? Then pre-computing b/2 (using a 2exp function) will help. -- Torbjörn