svn commit: r289815 - stable/9/sys/cddl/contrib/opensolaris/uts/common/sys

Andriy Gapon avg at FreeBSD.org
Fri Oct 23 08:38:11 UTC 2015


Author: avg
Date: Fri Oct 23 08:38:10 2015
New Revision: 289815
URL: https://svnweb.freebsd.org/changeset/base/289815

Log:
  MFC r284591: illums compat: use flsl/flsll for highbit/highbit64

Modified:
  stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h	Fri Oct 23 08:35:39 2015	(r289814)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h	Fri Oct 23 08:38:10 2015	(r289815)
@@ -32,6 +32,9 @@
 
 #include <sys/param.h>
 #include <sys/isa_defs.h>
+#if defined(__FreeBSD__) && defined(_KERNEL)
+#include <sys/libkern.h>
+#endif
 
 #ifdef	__cplusplus
 extern "C" {
@@ -382,6 +385,9 @@ extern unsigned char bcd_to_byte[256];
 static __inline int
 highbit(ulong_t i)
 {
+#if defined(__FreeBSD__) && defined(_KERNEL) && defined(HAVE_INLINE_FLSL)
+	return (flsl(i));
+#else
 	register int h = 1;
 
 	if (i == 0)
@@ -407,6 +413,7 @@ highbit(ulong_t i)
 		h += 1;
 	}
 	return (h);
+#endif
 }
 
 /*
@@ -416,6 +423,9 @@ highbit(ulong_t i)
 static __inline int
 highbit64(uint64_t i)
 {
+#if defined(__FreeBSD__) && defined(_KERNEL) && defined(HAVE_INLINE_FLSLL)
+	return (flsll(i));
+#else
 	int h = 1;
 
 	if (i == 0)
@@ -439,6 +449,7 @@ highbit64(uint64_t i)
 		h += 1;
 	}
 	return (h);
+#endif
 }
 
 #ifdef	__cplusplus


More information about the svn-src-stable-9 mailing list