Skip to content

Commit

Permalink
clz: use gcc's builtin clz implementation if available
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Blechmann committed Jun 19, 2009
1 parent 0314910 commit 2de0edd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Headers/plugin_interface/clz.h
Expand Up @@ -37,6 +37,17 @@ count leading zeroes function and those that can be derived from it
// powerpc native count leading zeroes instruction:
#define CLZ(x) ((int)__cntlzw((unsigned int)x))

#elif defined(__GCC__)

/* use gcc's builtins */
static __inline__ int32 CLZ(int32 arg)
{
if (arg)
return __builtin_clz(arg);
else
return 32;
}

#elif defined(SC_WIN32) && !defined(__GCC__)

static int32 CLZ( int32 arg )
Expand Down

0 comments on commit 2de0edd

Please sign in to comment.