Add missing macros for Windows and fix code using make_shared

Add missing MIN and MAX macros for Windows. Use std::make_shared instead
of call make_shared from a shared_ptr which is not supported on Windows.