X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Ffastlog.h;h=80b02e95224893dd7cfe8f413dd5ab977c88fb4f;hb=771a4a4e0c9b6653083f44081a81964c802eb549;hp=9897da773a497bf97f73328a6abc65906a9c0a26;hpb=30968b854257cb5f9159ca59589f783c85615601;p=ardour.git diff --git a/libs/pbd/pbd/fastlog.h b/libs/pbd/pbd/fastlog.h index 9897da773a..80b02e9522 100644 --- a/libs/pbd/pbd/fastlog.h +++ b/libs/pbd/pbd/fastlog.h @@ -1,11 +1,17 @@ -/* Copyright unknown. Code by Laurent de Soras . - */ +/* +Copyright © 2013 Laurent de Soras +This work is free. You can redistribute it and/or modify it under the +terms of the Do What The Fuck You Want To Public License, Version 2, +as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. +*/ #ifndef __pbd_fastlog_h__ #define __pbd_fastlog_h__ #include /* for HUGE_VAL */ +#include "pbd/libpbd_visibility.h" + static inline float fast_log2 (float val) { /* don't use reinterpret_cast<> because that prevents this @@ -19,9 +25,9 @@ static inline float fast_log2 (float val) 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); }