diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-03-21 12:59:13 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-03-21 12:59:13 -0400 |
commit | 4272d8f94dd4c4b00ef42778c5c5255cfb94feba (patch) | |
tree | 54718092f44656b5be7770b5fb0e57bc1aef7bb0 /floatprops.h | |
parent | b5b2be38fe26632e51b42e60a3cb9714576a9a5a (diff) | |
download | vecmathlib-4272d8f94dd4c4b00ef42778c5c5255cfb94feba.zip vecmathlib-4272d8f94dd4c4b00ef42778c5c5255cfb94feba.tar.gz |
Don't use typeinfo
Diffstat (limited to 'floatprops.h')
-rw-r--r-- | floatprops.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/floatprops.h b/floatprops.h index c39c788..2a50c1a 100644 --- a/floatprops.h +++ b/floatprops.h @@ -11,7 +11,6 @@ #include <iostream> #include <limits> #include <sstream> -#include <typeinfo> @@ -38,7 +37,11 @@ namespace vecmathlib { typedef int8_t int_t; typedef uint8_t uint_t; + static char const* name() { return "fp8"; } + // Definitions that might come from numeric_limits<> instead: + static int min() { __builtin_unreachable(); } + static int max() { __builtin_unreachable(); } static int const digits = 4; static int epsilon() { __builtin_unreachable(); } static int const min_exponent = -6; @@ -94,7 +97,11 @@ namespace vecmathlib { typedef int16_t int_t; typedef uint16_t uint_t; + static char const* name() { return "fp16"; } + // Definitions that might come from numeric_limits<> instead: + static int min() { __builtin_unreachable(); } + static int max() { __builtin_unreachable(); } static int const digits = 11; static int epsilon() { __builtin_unreachable(); } static int const min_exponent = -14; @@ -150,6 +157,8 @@ namespace vecmathlib { typedef int32_t int_t; typedef uint32_t uint_t; + static char const* name() { return "float"; } + // Ensure the internal representation is what we expect static_assert(is_signed, "real_t is not signed"); static_assert(radix==2, "real_t is not binary"); @@ -222,6 +231,8 @@ namespace vecmathlib { typedef int64_t int_t; typedef uint64_t uint_t; + static char const* name() { return "double"; } + // Ensure the internal representation is what we expect static_assert(is_signed, "real_t is not signed"); static_assert(radix==2, "real_t is not binary"); |