left circular shift

Dan Oetting dan_oetting at me.com
Sat Dec 25 18:25:07 CET 2010


On Dec 20, 2010, at 11:48, Torbjorn Granlund <tg at gmplib.org> wrote:

> Necati Demir <ndemir at demir.web.tr> writes:
> 
>  Is there function for left circular shift in libgmp? If not, how can i
>  implement?
> 
> I'd assume it'd mean to compute x*2^k mod (2^n-1) where n is the word
> bit count.  There is no direct function for that, but it should not hard
> to program it using the existing function.

I would recommend consulting a well reviewed resource such as wikipedia <http://en.wikipedia.org/wiki/Circular_shift> instead of relying on spur of the moment suggestions that appear to work for most cases but haven't been vetted for all edge cases.

--Dan Oetting


More information about the gmp-discuss mailing list