From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH 1/2] lib: int_sqrt: add int64_sqrt routine Date: Tue, 24 Jun 2014 13:25:04 -0700 Message-ID: <20140624132504.221cba6760b0d16849456bfd@linux-foundation.org> References: <1403516581-12560-1-git-send-email-21cnbao@gmail.com> <1403516581-12560-2-git-send-email-21cnbao@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:36510 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750985AbaFXUZG (ORCPT ); Tue, 24 Jun 2014 16:25:06 -0400 In-Reply-To: Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Peter Meerwald Cc: Yibo Cai , Barry Song <21cnbao@gmail.com>, "dmitry.torokhov@gmail.com" , "dtor@mail.ru" , "linux-input@vger.kernel.org" , DL-SHA-WorkGroupLinux , Barry Song On Tue, 24 Jun 2014 08:15:55 +0200 (CEST) Peter Meerwald wrote: > > > maybe the code could be #MACRO()'d to avoid duplication > > > > Do you mean to define int64_sqrt() directly as int_sqrt() on a 64 bit > > platform where sizeof(long) == sizeof(long long)? > > something along the lines of > > #define INT_SQRT(name, type) \ > type name(type x) \ > type m, y = 0, b; \ > ... > > INT_SQRT(int_sqrt, unsigned long); > INT_SQRT(int64_sqrt, unsigned long long); > > not sure if it is worth it We have made smaller optimisations in the past ;) But not a macro, please: #ifdef CONFIG_64BIT static inline unsigned long long int64_sqrt(unsigned long long x) { return int_sqrt(x); } #else unsigned long long int64_sqrt(unsigned long long x); #endif