From owner-freebsd-hackers@freebsd.org Tue Aug 11 23:23:28 2015 Return-Path: Delivered-To: freebsd-hackers@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 C60E399F3AF for ; Tue, 11 Aug 2015 23:23:28 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) (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 9BE526CB; Tue, 11 Aug 2015 23:23:28 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=VT0HECjZxTMgugMlElwPSRJm7V4X3doRP0mXJBJRNdU=; b=VAPbLEuw+5VLbkEC4KCS4PBM47UbfHhPZwI0ko1Q3PyPXPZRBKbKgEhuvQLEUHz3gEMxwJfHaLNdklY102ZYnk62U+g75A6L7cXbx54do2Js1XBFtQqxd9NOwO7JG+Dt31Y1bK/k43gbZsW1VpyMUF6yPShGsWievCtgk04D6TE=; Received: from [39.251.0.151] (port=43445 helo=X220.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZPIt7-0026hQ-DB; Tue, 11 Aug 2015 17:23:22 -0600 Date: Wed, 12 Aug 2015 07:23:14 +0800 From: Erich Dollansky To: Hans Petter Selasky Cc: Konstantin Belousov , "freebsd-hackers@freebsd.org" , Andriy Gapon Subject: Re: allow ffs & co. a binary search Message-ID: <20150812072314.5ff873ec@X220.alogt.com> In-Reply-To: <55C9BA23.10407@selasky.org> References: <20150607081315.7c0f09fb@B85M-HD3-0.alogt.com> <5573EA5E.40806@selasky.org> <20150607195245.62dc191f@B85M-HD3-0.alogt.com> <20150607135453.GH2499@kib.kiev.ua> <558175FA.4040106@FreeBSD.org> <20150617165331.GA2080@kib.kiev.ua> <5582CCF1.8010505@FreeBSD.org> <55C335A7.8020503@selasky.org> <20150811100327.0d12231f@X220.alogt.com> <55C9BA23.10407@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 23:23:28 -0000 Hi, On Tue, 11 Aug 2015 11:02:27 +0200 Hans Petter Selasky wrote: > On 08/11/15 04:03, Erich Dollansky wrote: > > Why not detect the built-in functions and do the binary search when > > they are not available and leave the original implementation for all > > other sizes? > > How can we detect this compile time? the compiler is known to macros at compile time. We can use this then for known compilers (gcc and clang) and use binary search for unknown compilers. I would not like to spend time on the hack as it would have to be tested. Of course, for unknown data sizes, I would leave the original in. As long as FreeBSD does not switch the compiler again, this will work. Erich