From ae7a54a4b6ddf6c8b0d16ecaa8145b2939aceec5 Mon Sep 17 00:00:00 2001
From: Mathias Gumz <akira at fluxbox dot org>
Date: Tue, 21 Sep 2010 00:04:46 +0200
Subject: bugfix: ' floating point exception' due wrongly placed code

while integrating the old 'getSqrt()' function into the 'bsqrt()'
function i misplaced some code. this lead to 'r' being 0 on the
first run. doh.
---
 src/FbTk/TextureRender.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index c2f8e07..7b808af 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -76,9 +76,10 @@ unsigned long bsqrt(unsigned int x) {
         sqrt_table[0] = 0;
         sqrt_table[1] = 1;
 
-        unsigned long r = x >> 1;
+        unsigned long r;
         unsigned long q;
         for (x = 2; x < SQRT_TABLE_ENTRIES; x++) {
+            r = x >> 1;
             while (1) {
                 q = x / r;
                 if (q >= r) {
-- 
cgit v0.11.2