#12371: The graph_decompositions/ code seems to have bounds issues
--------------------------------+-------------------------------------------
Reporter: Snark | Owner: jason, ncohen, rlm
Type: defect | Status: positive_review
Priority: major | Milestone: sage-5.0
Component: graph theory | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
--------------------------------+-------------------------------------------
Comment (by ncohen):
Helloooo Jeroen !!!
> That's not clear from looking at the code.
It is clearer now. The function is renamed to popcount32 and I added a
short docstring.
> That's my question: why do the test? Why not just do
> {{{
> cdef inline int popcount(int i):
> return __builtin_popcount(i)
> }}}
Oh. Because this code is much faster.
> Also: there are portability issues: `__builtin_popcount()` is a GCC
extension, certainly not supported by all compilers.
Arggggg ! `O_O;;;`
Well... I uploaded a new patch but I would like to have your advice on
that. I added a new function whose purpose is only to test popcount32, but
the test is *LONG* (around 5 minutes) so I flagged it with "not tested". I
thought it was too long even for a "long" flag. It tries "all 32bits
integers" and computes popcount in two different ways, to check for
correction. Considering how this 3-lines function is written I do not
expect it to cause problem on a different architecture (as long as we are
dealing with >=32bits integers... There is no 16bits left, right ?
`O_o;;;`).
Nathann
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12371#comment:26>
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.