summaryrefslogtreecommitdiffstats
path: root/libFDK/include/clz.h
diff options
context:
space:
mode:
Diffstat (limited to 'libFDK/include/clz.h')
-rw-r--r--libFDK/include/clz.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libFDK/include/clz.h b/libFDK/include/clz.h
index 38c5073..d276002 100644
--- a/libFDK/include/clz.h
+++ b/libFDK/include/clz.h
@@ -118,6 +118,11 @@ inline INT fixnormz_S (SHORT a)
{
return fixnormz_D((INT)(a));
}
+#elif defined(__GNUC__)
+inline INT fixnormz_S (SHORT a)
+{
+ return a ? __builtin_clz(a) : 16;
+}
#else
inline INT fixnormz_S (SHORT a)
{
@@ -134,6 +139,12 @@ inline INT fixnormz_S (SHORT a)
#endif
#if !defined(FUNCTION_fixnormz_D)
+#if defined(__GNUC__)
+inline INT fixnormz_D (LONG a)
+{
+ return a ? __builtin_clz(a) : 32;
+}
+#else
inline INT fixnormz_D (LONG a)
{
INT leadingBits = 0;
@@ -146,6 +157,7 @@ inline INT fixnormz_D (LONG a)
return (leadingBits);
}
#endif
+#endif
/*****************************************************************************