From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 12:03:13 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B188A8E; Sun, 19 Oct 2014 12:03:13 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 426A7E16; Sun, 19 Oct 2014 12:03:11 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA06395; Sun, 19 Oct 2014 15:03:04 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XfpCR-000P9z-QS; Sun, 19 Oct 2014 15:03:03 +0300 Message-ID: <5443A83F.5090807@FreeBSD.org> Date: Sun, 19 Oct 2014 15:02:07 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: "Alexander V. Chernikov" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw References: <201410191115.s9JBFJxA058370@svn.freebsd.org> In-Reply-To: <201410191115.s9JBFJxA058370@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 12:03:13 -0000 On 19/10/2014 14:15, Alexander V. Chernikov wrote: > +static uint32_t > +roundup2p(uint32_t v) > +{ > + > + v--; > + v |= v >> 1; > + v |= v >> 2; > + v |= v >> 4; > + v |= v >> 8; > + v |= v >> 16; > + v++; > + > + return (v); > +} I think that on platforms where an optimized version of fls() is available that would work faster than this cool piece of bit magic. -- Andriy Gapon