To fix this, I compared our implementation with the reference implementation in more detail again and found some differences. Aligning our and the reference implementation a bit more fixed the issue. Reference implementation: https://github.com/wjakob/dset/blob/master/dset.h Pull Request: https://projects.blender.org/blender/blender/pulls/118434