]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/fastmath.cxx
Adjust the fog punch through effect for oursun
[simgear.git] / simgear / math / fastmath.cxx
index ce8e253b4c59fe181cd04981ad6afba58e5f17fc..19968109b5532e0be7aa6aecea759ecbd25688a4 100644 (file)
@@ -20,7 +20,7 @@
 
 
 
-#include <fastmath.hxx>
+#include "fastmath.hxx"
 
 /**
  * This function is on avarage 9 times faster than the system exp() function
@@ -47,46 +47,17 @@ double fast_exp(double val) {
 }
 
 
-double fast_log2 (double val)
-{
-   int * const    exp_ptr = reinterpret_cast <int *> (&val);
-   int            x = *exp_ptr;
-   const int      log_2 = ((x >> 23) & 255) - 128;
-   x &= ~(255 << 23);
-   x += 127 << 23;
-   *exp_ptr = x;
-
-   val = ((-1.0f/3) * val + 2) * val - 2.0f/3;   // (1)
-
-   return (val + log_2);
-}
-
-/**
- * This function is about 3 times faster than the system log() function
- * and has an error of about 0.01%
- */
-double fast_log (double val)
-{
-   return (fast_log2 (val) * 0.69314718f);
-}
-
-double fast_log10 (double val)
-{
-   return (fast_log (val) / fast_log (10));
-}
-
-
 /**
  * While we're on the subject, someone might have use for these as well?
  * Float Shift Left and Float Shift Right. Do what you want with this.
  */
-void fast_BSL(double &x, register unsigned long shiftAmount) {
+void fast_BSL(float &x, register unsigned long shiftAmount) {
 
        *(unsigned long*)&x+=shiftAmount<<23;
 
 }
 
-void fast_BSR(double &x, register unsigned long shiftAmount) {
+void fast_BSR(float &x, register unsigned long shiftAmount) {
 
        *(unsigned long*)&x-=shiftAmount<<23;