Fix MSVC compiling + optimize ifdefs