Skip to content

Commit

Permalink
host_vector.cpp: Define _USE_MATH_DEFINES if _WIN32 is defined. (#…
Browse files Browse the repository at this point in the history
…250)

This fixes a build issue with MSVC 2022 v17.11:
```
.../rocALUTION/src/base/host/host_vector.cpp:400:62: error: no member named 'M_PI' in 'rocalution::HostVector<float>'
  400 |                             * cos(static_cast<ValueType>(2 * M_PI) * u2);
      |                                                              ^
```

The preprocessor condition for whether to define `_USE_MATH_DEFINES`
currently checks whether `WIN32` is defined. But it is not for that compiler.
It should be enough to check whether `_WIN32` is defined:
http://msdn.microsoft.com/en-us/library/ff540443.aspx

But in other places in the code base more alternative spellings are checked.
So, use the same condition here, too.
  • Loading branch information
mmuetzel authored Sep 30, 2024
1 parent 1ee32aa commit fd5f402
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/base/host/host_vector.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ************************************************************************
* Copyright (C) 2018-2023 Advanced Micro Devices, Inc. All rights Reserved.
* Copyright (C) 2018-2024 Advanced Micro Devices, Inc. All rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,7 +20,7 @@
* THE SOFTWARE.
*
* ************************************************************************ */
#if defined(WIN32)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
#define _USE_MATH_DEFINES
#endif

Expand Down

0 comments on commit fd5f402

Please sign in to comment.