I didn’t comment on that, but since you do, let’s go
The “unsigned long” type in C++ is only specified to have at least 32 bits. As shown by CG_LSD in the comments, on his platform “unsigned long” take 64 bit values. Hence the rest of his code should work as expected with the corrections I suggest.
In any case, to make it more less confusing I also prefer to use the “int64_t” type notations.
Yeah, quite a number of things actually, the vast majority of which probably don’t matter in everyday use. It would not be practical, helpful or even feasible to try to list them.