[coyotos-dev] BigNum issues
Thomas Stratmann
thomas.stratmann at rub.de
Sun Oct 7 19:15:21 EDT 2007
There's a number of problems in the shifting functions.
vu_rshift_digits has an off-by-some problem (see attached index.patch).
vu_rshift_bits is broken. First it shifts n1 by nShift / 32 digits,
result in n2, then puts n1 bitshifted by nShift %= 32 into n2.
Similarly in vu_lshift_bits.
ALL bit and digit shifting functions are lacking requirements, which is
why I'm answering this thread... and the reason why I didn't bother
fixing for now.
vu_lshift_digits is not zeroing n2's leading digits in case n1 is too
short (this may be just a missing requirement).
/--/
Additionally, have a look at BigNum::lshift_digits(size_t n):
It depends on alloca zeroing the allocated memory (which I suspect it
does, but failed to investigate). If this is the case, the rmemset calls
in vu_mul (and I think I spotted this somewhere else...) are superfluous.
/--/
Finally, constructing an nvec from a BigNum should result in a constant
since it borrows the BigNum's innerds. Also the global nvec 0's and 1's
representation should be constant. See attached noclobber.patch.
Thomas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: index.patch
Url: http://www.coyotos.org/pipermail/coyotos-dev/attachments/20071008/ca95751d/attachment.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: noclobber.patch
Url: http://www.coyotos.org/pipermail/coyotos-dev/attachments/20071008/ca95751d/attachment-0001.pl
More information about the coyotos-dev
mailing list