News for hackers. Stuff that matters.
Re:Calculating integer factorials in constant time, taking a... by arbre on Tuesday December 15, 2015 @11:14AM (#10738571)
You can also compute the factorials at compile time with templates:

template<int64_t n> int64_t fact() { return n * fact<n-1>(); } template<> int64_t fact<0>() { return 1; }

The book "Modern C++ design" from Alexandrescu extensively covers that kind of stuff.

There might even be a way to use a loop and constexprs.

Re:Calculating integer factorials in constant time, taking a... by wyager on Tuesday December 15, 2015 @11:38AM (#10738724)
Won't most modern compiled languages statically evaluate constant numerical expressions?