[Libre-soc-dev] SVP64 Vectorised add-carry => big int add
programmerjake at gmail.com
Mon Apr 18 17:44:05 BST 2022
On Mon, Apr 18, 2022, 09:23 Jacob Lifshay <programmerjake at gmail.com> wrote:
> On Mon, Apr 18, 2022, 08:33 lkcl <luke.leighton at gmail.com> wrote:
>> i implemented it here, after finding a suitable c-code implementation
>> online (hacker's delight, by hannah suarez) and it didn't work
>> any clues as to why?
> yes...there's 2 problems:
> 1. sum is uninitialized -- did you even compile with warnings enabled?!
> (another UB trap in C, if you had used Rust or basically any good language
> it would have not let you compile that).
another problem i spotted, borrow out in k is used, the algorithm i gave
has carry out instead, the code needs to be adjusted here:
basically you need to replace the assignment to un[i + n] after the loop
with instead running the loop one more iteration, but with 0 instead of
vn[i] (since that'd be an out-of-bounds read).
More information about the Libre-soc-dev