#17196: Relax assumptions on bitset operations
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.4
Component: misc | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: public/17196 | Commit:
/relax-assumptions-on-bitset- | 3ae75a1f8fcfee0f78faf9bb4bb006149b535c45
operations | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
How clever are compilers?
The question is related to idioms like `n % GMP_LIMB_BITS`.
`GMP_LIMB_BITS` is a power of two, and it is known at compile time. Hence,
`n % GMP_LIMB_BITS` does not involve a generally very expensive
`%`-operation, but boils down to a simple `&`.
Will compilers automatically use this optimization? If not, then I think
we should introduce an integer constant `mod_mp_bits_per_limb` (see
#15820), so that `n % GMP_LIMB_BITS == n & mp_bits_per_limb`. If yes, then
I guess one can also avoid `n >> index_shift`, and use `n//GMP_LIMB_BITS`
instead.
--
Ticket URL: <http://trac.sagemath.org/ticket/17196#comment:11>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.