Make C helper function more closely match the pure python version, and add tests.
2 files changed