diff --git a/src/gamma.c b/src/gamma.c index c538b590..21e13a70 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -88,11 +88,11 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) // Apply gamma curve value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f; - // Clamp to value range - if (value < 0.f) - value = 0.f; - else if (value > 65535.f) - value = 65535.f; + // 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. + if (value > 65535.f) + value = 65535.f; values[i] = (unsigned short) value; } diff --git a/src/glx_context.c b/src/glx_context.c index d8989dff..724037f4 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -191,14 +191,12 @@ static GLXContext createLegacyContext(_GLFWwindow* window, share, True); } - else - { - return glXCreateNewContext(_glfw.x11.display, - fbconfig, - GLX_RGBA_TYPE, - share, - True); - } + + return glXCreateNewContext(_glfw.x11.display, + fbconfig, + GLX_RGBA_TYPE, + share, + True); } diff --git a/src/input.c b/src/input.c index c415462e..f63d71e1 100644 --- a/src/input.c +++ b/src/input.c @@ -64,7 +64,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode) _glfw.cursorPosY = window->cursorPosY; _glfwPlatformGetWindowSize(window, &width, &height); - _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0); + _glfwPlatformSetCursorPos(window, width * 0.5, height * 0.5); } _glfwPlatformSetCursorMode(window, newMode);