- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 688
 
Closed
Description
Currently, some code for bit-shifts in Z/(n) looks like
    def __lshift__(IntegerMod_gmp self, int right):
        ...
        cdef IntegerMod_gmp x
        x = self._new_c()
        mpz_mul_2exp(x.value, self.value, right)
        mpz_fdiv_r(x.value, x.value, self.__modulus.sageInteger.value)
        return x
where the method mpz_mul_2exp expect an unsigned long.  Negative values of right thus cause undesired integral promotion.
Component: basic arithmetic
Keywords: bit shift, integer mod ring
Author: Sebastian Pancratz
Reviewer: Tom Boothby
Merged: sage-4.3.2.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/7949