#7949: Bit-shifts in Z/(n)
--------------------------------+-------------------------------------------
Reporter: spancratz | Owner: spancratz
Type: defect | Status: new
Priority: minor | Milestone: sage-4.3.1
Component: basic arithmetic | Keywords: bit shift, integer mod ring
Work_issues: | Author: spancratz
Upstream: N/A | Reviewer:
Merged: |
--------------------------------+-------------------------------------------
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.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7949>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.