RSS/Atom feed Twitter
Site is read-only, email is disabled

[PATCH 1/1] noise-cell: Use f suffix for float constants.

This discussion is connected to the gegl-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

[PATCH 1/1] noise-cell: Use f suffix for float constants. Jan Vesely 20 Apr 17:34
Jan Vesely
2014-04-20 17:34:13 UTC (almost 10 years ago)

[PATCH 1/1] noise-cell: Use f suffix for float constants.

Unsuffixed literal has type double (taken from c99 specs). Fixes clang warnings:
warning: double precision constant requires cl_khr_fp64, casting to single precision

Signed-off-by: Jan Vesely ---
opencl/noise-cell.cl | 6 +++---
opencl/noise-cell.cl.h | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/opencl/noise-cell.cl b/opencl/noise-cell.cl index e3c223d..036d060 100644
--- a/opencl/noise-cell.cl
+++ b/opencl/noise-cell.cl
@@ -125,7 +125,7 @@ __kernel void kernel_noise (__global float *out, int s = (int)floor(x);
int t = (int)floor(y);

- for (i = 0 ; i < rank ; closest[i] = 1.0 / 0.0, i += 1); + for (i = 0 ; i < rank ; closest[i] = 1.0f / 0.0f, i += 1);
/* Search the box the point is in. */
@@ -133,9 +133,9 @@ __kernel void kernel_noise (__global float *out,
d_0 = &closest[rank - 1];
d_l = x - s; d_l *= d_l;
- d_r = 1.0 - x + s; d_r *= d_r; + d_r = 1.0f - x + s; d_r *= d_r; d_b = y - t; d_b *= d_b;
- d_t = 1.0 - y + t; d_t *= d_t; + d_t = 1.0f - y + t; d_t *= d_t;
/* Search adjacent boxes if it is possible for them to contain a * nearby feature point. */
diff --git a/opencl/noise-cell.cl.h b/opencl/noise-cell.cl.h index 7ad09b4..3a40acf 100644
--- a/opencl/noise-cell.cl.h
+++ b/opencl/noise-cell.cl.h
@@ -126,7 +126,7 @@ static const char* noise_cell_cl_source = " int s = (int)floor(x); \n" " int t = (int)floor(y); \n" " \n" -" for (i = 0 ; i < rank ; closest[i] = 1.0 / 0.0, i += 1); \n" +" for (i = 0 ; i < rank ; closest[i] = 1.0f / 0.0f, i += 1); \n" " \n" " /* Search the box the point is in. */ \n" " \n" @@ -134,9 +134,9 @@ static const char* noise_cell_cl_source = " \n" " d_0 = &closest[rank - 1]; \n" " d_l = x - s; d_l *= d_l; \n" -" d_r = 1.0 - x + s; d_r *= d_r; \n" +" d_r = 1.0f - x + s; d_r *= d_r; \n" " d_b = y - t; d_b *= d_b; \n" -" d_t = 1.0 - y + t; d_t *= d_t; \n" +" d_t = 1.0f - y + t; d_t *= d_t; \n" " \n" " /* Search adjacent boxes if it is possible for them to contain a \n" " * nearby feature point. */ \n"

1.9.0