Closed jimhester closed 3 years ago
@jimhester i think that setting the middle, low, and high markers to always be unsigned would also be correct, yes?
yeah that should work as well
Put the fix into the latest patch on the feature branch for subsetting along with another fix
Thanks for the catch
At https://github.com/PRL-PRG/UFOs/blob/84c8ac6476afdb5ee7993ab54dc6727e1e22377b/ufos/src/mappedMemory/sparseList.c#L92-L93
The key insight in the linked post seems to be that the sum needs to be done with unsigned arithmetic, otherwise the sum overflows. Your implementation uses signed 64 bit integers in the sum, so I believe it would still have the same issue.
In languages with
>>>
, the sign is discarded, so the overflow doesn't matter, but C and C++ don't have this operator so you need to cast the operands touint64_t
before summing I believe.See http://codepad.org/HnaW00QX for an example