diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-06-18 11:36:58 -0400 |
|---|---|---|
| committer | jsmall-nvidia <jsmall@nvidia.com> | 2020-06-18 11:36:58 -0400 |
| commit | f9b5f18fb5306e3dc1f9bef8106f98b5f9cb468f (patch) | |
| tree | 8e4a5eb4808a2356afb223480b1e3f65b88c291e | |
| parent | 31ae3467242995ab822a29c4148c2e86df2f1eb8 (diff) | |
* Fix warnings from prelude
* Make compilation work on gcc by disabling -Wclass-mem-access
| -rw-r--r-- | prelude/slang-cpp-scalar-intrinsics.h | 14 | ||||
| -rw-r--r-- | premake5.lua | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/prelude/slang-cpp-scalar-intrinsics.h b/prelude/slang-cpp-scalar-intrinsics.h index c814365c6..c7d654170 100644 --- a/prelude/slang-cpp-scalar-intrinsics.h +++ b/prelude/slang-cpp-scalar-intrinsics.h @@ -84,7 +84,7 @@ SLANG_FORCE_INLINE float F32_frexp(float x, float& e) { int ei; float m = ::frexpf(x, &ei); - e = ei; + e = float(ei); return m; } SLANG_FORCE_INLINE float F32_modf(float x, float& ip) @@ -151,9 +151,10 @@ SLANG_FORCE_INLINE double F64_frexp(double x, double& e) { int ei; double m = ::frexp(x, &ei); - e = ei; + e = float(ei); return m; } + SLANG_FORCE_INLINE double F64_modf(double x, double& ip) { return ::modf(x, &ip); @@ -236,14 +237,17 @@ SLANG_FORCE_INLINE uint64_t U64_abs(uint64_t f) { return f; } SLANG_FORCE_INLINE uint64_t U64_min(uint64_t a, uint64_t b) { return a < b ? a : b; } SLANG_FORCE_INLINE uint64_t U64_max(uint64_t a, uint64_t b) { return a > b ? a : b; } +// TODO(JS): We don't define countbits for 64bit in stdlib currently. +// It's not clear from documentation if it should return 32 or 64 bits, if it exists. +// 32 bits can always hold the result, and will be implicitly promoted. SLANG_FORCE_INLINE uint32_t U64_countbits(uint64_t v) { #if SLANG_GCC_FAMILY - return __builtin_popcountl(v); + return uint32_t(__builtin_popcountl(v)); #elif SLANG_PROCESSOR_X86_64 && SLANG_VC - return __popcnt64(v); + return uint32_t(__popcnt64(v)); #else - uint64_t c = 0; + uint32_t c = 0; while (v) { c++; diff --git a/premake5.lua b/premake5.lua index 93d310ee0..2b3385b1c 100644 --- a/premake5.lua +++ b/premake5.lua @@ -201,7 +201,7 @@ workspace "slang" architecture "ARM" filter { "toolset:clang or gcc*" } - buildoptions { "-Wno-unused-parameter", "-Wno-type-limits", "-Wno-sign-compare", "-Wno-unused-variable", "-Wno-reorder", "-Wno-switch", "-Wno-return-type", "-Wno-unused-local-typedefs", "-Wno-parentheses", "-std=c++11", "-fvisibility=hidden" , "-Wno-ignored-optimization-argument", "-Wno-unknown-warning-option"} + buildoptions { "-Wno-unused-parameter", "-Wno-type-limits", "-Wno-sign-compare", "-Wno-unused-variable", "-Wno-reorder", "-Wno-switch", "-Wno-return-type", "-Wno-unused-local-typedefs", "-Wno-parentheses", "-std=c++11", "-fvisibility=hidden" , "-Wno-ignored-optimization-argument", "-Wno-unknown-warning-option", "-Wno-class-memaccess"} filter { "toolset:gcc*"} buildoptions { "-Wno-unused-but-set-variable", "-Wno-implicit-fallthrough" } |
