# HG changeset patch
# User Craig Citro <craigcitro@gmail.com>
# Date 1232697108 28800
# Node ID f85a6ac61baf7ca7032a6a0de25f11adf67026ea
# Parent f8fb0bf3e547d65a0f90f5b27d543c8cf4ca9da0
Fix trac #3571 -- make ivalue field no longer public.
diff -r f8fb0bf3e547 -r f85a6ac61baf sage/rings/integer_mod.pxd
a
|
b
|
|
35 | 35 | cdef IntegerMod_gmp _new_c(self) |
36 | 36 | |
37 | 37 | cdef class IntegerMod_int(IntegerMod_abstract): |
38 | | cdef public int_fast32_t ivalue |
| 38 | cdef int_fast32_t ivalue |
39 | 39 | cdef void set_from_int(IntegerMod_int self, int_fast32_t value) |
40 | 40 | cdef int_fast32_t get_int_value(IntegerMod_int self) |
41 | 41 | cdef IntegerMod_int _new_c(self, int_fast32_t value) |
diff -r f8fb0bf3e547 -r f85a6ac61baf sage/rings/integer_mod.pyx
a
|
b
|
|
1472 | 1472 | |
1473 | 1473 | |
1474 | 1474 | |
1475 | | cdef int _cmp_c_impl(left, Element right) except -2: |
| 1475 | cdef int _cmp_c_impl(self, Element right) except -2: |
1476 | 1476 | """ |
1477 | 1477 | EXAMPLES: |
1478 | 1478 | sage: mod(5,13) == mod(-8,13) |
… |
… |
|
1486 | 1486 | sage: mod(0, 13) == int(0) |
1487 | 1487 | True |
1488 | 1488 | """ |
1489 | | if (<IntegerMod_int>left).ivalue == (<IntegerMod_int>right).ivalue: |
| 1489 | if self.ivalue == (<IntegerMod_int>right).ivalue: |
1490 | 1490 | return 0 |
1491 | | elif (<IntegerMod_int>left).ivalue < (<IntegerMod_int>right).ivalue: |
| 1491 | elif self.ivalue < (<IntegerMod_int>right).ivalue: |
1492 | 1492 | return -1 |
1493 | 1493 | else: |
1494 | 1494 | return 1 |
… |
… |
|
1643 | 1643 | sage: R(7) * R(8) |
1644 | 1644 | 6 |
1645 | 1645 | """ |
1646 | | return self._new_c((self.ivalue * right.ivalue) % self.__modulus.int32) |
| 1646 | return self._new_c((self.ivalue * (<IntegerMod_int>right).ivalue) % self.__modulus.int32) |
1647 | 1647 | |
1648 | 1648 | cpdef RingElement _imul_(self, RingElement right): |
1649 | 1649 | """ |
… |
… |
|
1652 | 1652 | sage: R(7) * R(8) |
1653 | 1653 | 6 |
1654 | 1654 | """ |
1655 | | self.ivalue = (self.ivalue * right.ivalue) % self.__modulus.int32 |
| 1655 | self.ivalue = (self.ivalue * (<IntegerMod_int>right).ivalue) % self.__modulus.int32 |
1656 | 1656 | return self |
1657 | 1657 | |
1658 | 1658 | cpdef RingElement _div_(self, RingElement right): |
… |
… |
|
2179 | 2179 | return self.ivalue |
2180 | 2180 | |
2181 | 2181 | |
2182 | | cdef int _cmp_c_impl(left, Element right) except -2: |
| 2182 | cdef int _cmp_c_impl(self, Element right) except -2: |
2183 | 2183 | """ |
2184 | 2184 | EXAMPLES: |
2185 | 2185 | sage: mod(5,13^5) == mod(13^5+5,13^5) |
… |
… |
|
2193 | 2193 | sage: mod(0, 13^5) == int(0) |
2194 | 2194 | True |
2195 | 2195 | """ |
2196 | | if (<IntegerMod_int64>left).ivalue == (<IntegerMod_int64>right).ivalue: return 0 |
2197 | | elif (<IntegerMod_int64>left).ivalue < (<IntegerMod_int64>right).ivalue: return -1 |
| 2196 | if self.ivalue == (<IntegerMod_int64>right).ivalue: return 0 |
| 2197 | elif self.ivalue < (<IntegerMod_int64>right).ivalue: return -1 |
2198 | 2198 | else: return 1 |
2199 | 2199 | |
2200 | 2200 | def __richcmp__(left, right, int op): |