summaryrefslogtreecommitdiffstats
path: root/prelude
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-10-27 06:03:34 +0800
committerGitHub <noreply@github.com>2023-10-26 15:03:34 -0700
commit41e17d370d67a584fbac9bbbe435c057c18715f4 (patch)
tree7d262d4734186fda93ea32ab9f1a7c31b7ef2e1c /prelude
parentbee74b16eafa64ccc33bb386a1dc753cd6c41a82 (diff)
Make the exponent return value from frexp int (#3284)
* Make the exponent return value from frexp int Fixes https://github.com/shader-slang/slang/issues/3282 * Update slang-llvm. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'prelude')
-rw-r--r--prelude/slang-cpp-scalar-intrinsics.h22
-rw-r--r--prelude/slang-cuda-prelude.h18
2 files changed, 10 insertions, 30 deletions
diff --git a/prelude/slang-cpp-scalar-intrinsics.h b/prelude/slang-cpp-scalar-intrinsics.h
index 2b9e7f777..acbe00152 100644
--- a/prelude/slang-cpp-scalar-intrinsics.h
+++ b/prelude/slang-cpp-scalar-intrinsics.h
@@ -169,7 +169,8 @@ float F32_fmod(float a, float b);
float F32_remainder(float a, float b);
float F32_atan2(float a, float b);
-float F32_frexp(float x, float* e);
+float F32_frexp(float x, int* e);
+
float F32_modf(float x, float* ip);
// Ternary
@@ -213,13 +214,8 @@ SLANG_FORCE_INLINE float F32_fmod(float a, float b) { return ::fmodf(a, b); }
SLANG_FORCE_INLINE float F32_remainder(float a, float b) { return ::remainderf(a, b); }
SLANG_FORCE_INLINE float F32_atan2(float a, float b) { return float(::atan2(a, b)); }
-SLANG_FORCE_INLINE float F32_frexp(float x, float* e)
-{
- int ei;
- float m = ::frexpf(x, &ei);
- *e = float(ei);
- return m;
-}
+SLANG_FORCE_INLINE float F32_frexp(float x, int* e) { return ::frexpf(x, e); }
+
SLANG_FORCE_INLINE float F32_modf(float x, float* ip)
{
return ::modff(x, ip);
@@ -289,7 +285,7 @@ double F64_fmod(double a, double b);
double F64_remainder(double a, double b);
double F64_atan2(double a, double b);
-double F64_frexp(double x, double* e);
+double F64_frexp(double x, int* e);
double F64_modf(double x, double* ip);
@@ -335,13 +331,7 @@ SLANG_FORCE_INLINE double F64_fmod(double a, double b) { return ::fmod(a, b); }
SLANG_FORCE_INLINE double F64_remainder(double a, double b) { return ::remainder(a, b); }
SLANG_FORCE_INLINE double F64_atan2(double a, double b) { return ::atan2(a, b); }
-SLANG_FORCE_INLINE double F64_frexp(double x, double* e)
-{
- int ei;
- double m = ::frexp(x, &ei);
- *e = float(ei);
- return m;
-}
+SLANG_FORCE_INLINE double F64_frexp(double x, int* e) { return ::frexp(x, e); }
SLANG_FORCE_INLINE double F64_modf(double x, double* ip)
{
diff --git a/prelude/slang-cuda-prelude.h b/prelude/slang-cuda-prelude.h
index 9075ed3d3..24e400d2d 100644
--- a/prelude/slang-cuda-prelude.h
+++ b/prelude/slang-cuda-prelude.h
@@ -1018,13 +1018,8 @@ SLANG_FORCE_INLINE SLANG_CUDA_CALL float F32_fmod(float a, float b) { return ::f
SLANG_FORCE_INLINE SLANG_CUDA_CALL float F32_remainder(float a, float b) { return ::remainderf(a, b); }
SLANG_FORCE_INLINE SLANG_CUDA_CALL float F32_atan2(float a, float b) { return float(::atan2(a, b)); }
-SLANG_FORCE_INLINE SLANG_CUDA_CALL float F32_frexp(float x, float* e)
-{
- int ei;
- float m = ::frexpf(x, &ei);
- *e = ei;
- return m;
-}
+SLANG_FORCE_INLINE SLANG_CUDA_CALL float F32_frexp(float x, int* e) { return frexpf(x, e); }
+
SLANG_FORCE_INLINE SLANG_CUDA_CALL float F32_modf(float x, float* ip)
{
return ::modff(x, ip);
@@ -1077,13 +1072,8 @@ SLANG_FORCE_INLINE SLANG_CUDA_CALL double F64_fmod(double a, double b) { return
SLANG_FORCE_INLINE SLANG_CUDA_CALL double F64_remainder(double a, double b) { return ::remainder(a, b); }
SLANG_FORCE_INLINE SLANG_CUDA_CALL double F64_atan2(double a, double b) { return ::atan2(a, b); }
-SLANG_FORCE_INLINE SLANG_CUDA_CALL double F64_frexp(double x, double* e)
-{
- int ei;
- double m = ::frexp(x, &ei);
- *e = ei;
- return m;
-}
+SLANG_FORCE_INLINE SLANG_CUDA_CALL double F64_frexp(double x, int* e) { return ::frexp(x, e); }
+
SLANG_FORCE_INLINE SLANG_CUDA_CALL double F64_modf(double x, double* ip)
{
return ::modf(x, ip);