From e49b5ffa26b55d259fe2a5a259e446b53462c922 Mon Sep 17 00:00:00 2001 From: siavash Date: Fri, 5 Jul 2013 04:12:22 +0430 Subject: [PATCH] Fixed coding style and removed C99 function. --- src/gamma.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gamma.c b/src/gamma.c index 0bf24e4e..d09d25e7 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -87,12 +87,13 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) inv255 = 1.f / 255.f; value = i * inv255; // Apply gamma curve - value = powf(value, 1.f / gamma) * 65535.f + 0.5f; + value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f; - // Clamp to value range + // Clamp to value range [0.f, 65535.f] // There isn't any need to check for values smaller than zero. // It is always positive and bigger than 0.5f. - value = value < 65535.f ? value : 65535.f; + if (value > 65535.f) + value = 65535.f; values[i] = (unsigned short) value; }