From owner-svn-src-all@freebsd.org Thu Oct 22 20:28:39 2015 Return-Path: Delivered-To: svn-src-all@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 7F0B5A1C0BD; Thu, 22 Oct 2015 20:28:39 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 474DB1D75; Thu, 22 Oct 2015 20:28:39 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9MKScAT032878; Thu, 22 Oct 2015 20:28:38 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9MKSbRu032869; Thu, 22 Oct 2015 20:28:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201510222028.t9MKSbRu032869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Thu, 22 Oct 2015 20:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289765 - in head/sys: conf libkern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Oct 2015 20:28:39 -0000 Author: cem Date: Thu Oct 22 20:28:37 2015 New Revision: 289765 URL: https://svnweb.freebsd.org/changeset/base/289765 Log: Add libkern ffsll() for parity with flsll() Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3962 Added: head/sys/libkern/ffsll.c (contents, props changed) Modified: head/sys/conf/files.arm head/sys/conf/files.arm64 head/sys/conf/files.i386 head/sys/conf/files.mips head/sys/conf/files.pc98 head/sys/conf/files.powerpc head/sys/conf/files.sparc64 head/sys/sys/libkern.h Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/conf/files.arm Thu Oct 22 20:28:37 2015 (r289765) @@ -120,6 +120,7 @@ libkern/ashldi3.c standard libkern/ashrdi3.c standard libkern/divdi3.c standard libkern/ffsl.c standard +libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/conf/files.arm64 Thu Oct 22 20:28:37 2015 (r289765) @@ -82,6 +82,7 @@ kern/subr_dummy_vdso_tc.c standard libkern/bcmp.c standard libkern/ffs.c standard libkern/ffsl.c standard +libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/conf/files.i386 Thu Oct 22 20:28:37 2015 (r289765) @@ -530,6 +530,7 @@ kern/imgact_aout.c optional compat_aout kern/imgact_gzip.c optional gzip kern/subr_sfbuf.c standard libkern/divdi3.c standard +libkern/ffsll.c standard libkern/flsll.c standard libkern/memmove.c standard libkern/memset.c standard Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/conf/files.mips Thu Oct 22 20:28:37 2015 (r289765) @@ -56,6 +56,7 @@ kern/subr_sfbuf.c optional mips | mips # gcc/clang runtime libkern/ffsl.c standard +libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/conf/files.pc98 Thu Oct 22 20:28:37 2015 (r289765) @@ -222,6 +222,7 @@ kern/imgact_aout.c optional compat_aout kern/imgact_gzip.c optional gzip kern/subr_sfbuf.c standard libkern/divdi3.c standard +libkern/ffsll.c standard libkern/flsll.c standard libkern/memmove.c standard libkern/memset.c standard Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/conf/files.powerpc Thu Oct 22 20:28:37 2015 (r289765) @@ -87,6 +87,7 @@ libkern/cmpdi2.c optional powerpc libkern/divdi3.c optional powerpc libkern/ffs.c standard libkern/ffsl.c standard +libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard Modified: head/sys/conf/files.sparc64 ============================================================================== --- head/sys/conf/files.sparc64 Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/conf/files.sparc64 Thu Oct 22 20:28:37 2015 (r289765) @@ -67,6 +67,7 @@ kern/syscalls.c optional ktr kern/subr_sfbuf.c standard libkern/ffs.c standard libkern/ffsl.c standard +libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard Added: head/sys/libkern/ffsll.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/libkern/ffsll.c Thu Oct 22 20:28:37 2015 (r289765) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +/* + * Find First Set bit + */ +int +ffsll(long long mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; !(mask & 1); bit++) + mask = (unsigned long long)mask >> 1; + return (bit); +} Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Thu Oct 22 19:42:57 2015 (r289764) +++ head/sys/sys/libkern.h Thu Oct 22 20:28:37 2015 (r289765) @@ -89,6 +89,9 @@ int ffs(int); #ifndef HAVE_INLINE_FFSL int ffsl(long); #endif +#ifndef HAVE_INLINE_FFSLL +int ffsll(long long); +#endif #ifndef HAVE_INLINE_FLS int fls(int); #endif