From owner-svn-src-stable-10@freebsd.org Fri Oct 2 20:13:57 2015 Return-Path: <owner-svn-src-stable-10@freebsd.org> Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCA44A0E23D; Fri, 2 Oct 2015 20:13:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA80117A3; Fri, 2 Oct 2015 20:13:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92KDvbH080814; Fri, 2 Oct 2015 20:13:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92KDvt5080813; Fri, 2 Oct 2015 20:13:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510022013.t92KDvt5080813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin <mav@FreeBSD.org> Date: Fri, 2 Oct 2015 20:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288521 - stable/10/sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree <svn-src-stable-10.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-stable-10>, <mailto:svn-src-stable-10-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-10/> List-Post: <mailto:svn-src-stable-10@freebsd.org> List-Help: <mailto:svn-src-stable-10-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10>, <mailto:svn-src-stable-10-request@freebsd.org?subject=subscribe> X-List-Received-Date: Fri, 02 Oct 2015 20:13:57 -0000 Author: mav Date: Fri Oct 2 20:13:56 2015 New Revision: 288521 URL: https://svnweb.freebsd.org/changeset/base/288521 Log: MFC r284591 (by avg): illums compat: use flsl/flsll for highbit/highbit64 Do that only when when fast inline versions are available. At the moment that can be the case only in the kernel and not for all platforms. The original code uses the binary search and that's kept as a fallback. This is a micro optimization. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Oct 2 20:09:16 2015 (r288520) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Oct 2 20:13:56 2015 (r288521) @@ -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