Add non-power-of-two check to GenericMath.

Required for https://github.com/SpoutDev/Caustic/pull/7