https://forum.dlang.org/post/p7726n$2apd$1@digitalmars.com TODO: test if ulong.max gives better performance
See Implementation