aboutsummaryrefslogtreecommitdiffstats
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 90cdb2b..4f7d240 100644
--- a/libFDK/include/clz.h
+++ b/libFDK/include/clz.h
@@ -115,6 +115,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)
{
@@ -131,6 +136,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;
@@ -143,6 +154,7 @@ inline INT fixnormz_D (LONG a)
return (leadingBits);
}
#endif
+#endif
/*****************************************************************************