diff options
author | Robert Jonsson <spamatica@gmail.com> | 2011-09-15 12:14:55 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2011-09-15 12:14:55 +0000 |
commit | b0546e5e7f7044019892543c6c82029db8d564a7 (patch) | |
tree | 1b96a6260900f3fbf3513fb48a5a72aa89052dc8 /attic/muse2-oom/muse2/awl/fastlog.h | |
parent | 583c73d1a07154d3d2672d65d8cce6495f490454 (diff) |
moved attic to a branch of it's own
Diffstat (limited to 'attic/muse2-oom/muse2/awl/fastlog.h')
-rw-r--r-- | attic/muse2-oom/muse2/awl/fastlog.h | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/attic/muse2-oom/muse2/awl/fastlog.h b/attic/muse2-oom/muse2/awl/fastlog.h deleted file mode 100644 index 90a85342..00000000 --- a/attic/muse2-oom/muse2/awl/fastlog.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright unknown. Code by Laurent de Soras <laurent@ohmforce.com>. - */ - -#ifndef __FASTLOG_H__ -#define __FASTLOG_H__ - -#include <math.h> /* for HUGE_VAL */ - -static inline float fast_log2 (float val) - { - /* don't use reinterpret_cast<> because that prevents this - from being used by pure C code (for example, GnomeCanvasItems) - */ - union {float f; int i;} t; - t.f = val; - int* const exp_ptr = &t.i; - 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) * t.f + 2) * t.f - 2.0f/3; - return (val + log_2); - } - -static inline float fast_log (const float val) - { - return (fast_log2 (val) * 0.69314718f); - } - -static inline float fast_log10 (const float val) - { - return fast_log2(val) / 3.312500f; - } - -static inline float minus_infinity() { return -HUGE_VAL; } - -#endif - |