Resolve conflict with windef.h macros and remove implicit cast

As soon as windef.h is included in a project (or another file which defines the max-macro), the existing calls to std::numeric_limits<Type>::max won't compile. I added defensive parenthesis to resolve this conflict.