use new Math::PinToMaxForType<> template to silence a few warnings (and fix overflow bugs)