Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754483AbYFCJKa (ORCPT ); Tue, 3 Jun 2008 05:10:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752032AbYFCJKX (ORCPT ); Tue, 3 Jun 2008 05:10:23 -0400 Received: from aun.it.uu.se ([130.238.12.36]:51256 "EHLO aun.it.uu.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751887AbYFCJKW (ORCPT ); Tue, 3 Jun 2008 05:10:22 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18501.2572.137148.78927@harpo.it.uu.se> Date: Tue, 3 Jun 2008 11:08:28 +0200 From: Mikael Pettersson To: Peter Oberparleiter Cc: linux-kernel@vger.kernel.org, Andrew Morton , Harvey Harrison , Peter Oberparleiter Subject: Re: [RFC PATCH] consolidate within() implementations In-Reply-To: <48441D35.7010200@de.ibm.com> References: <48441D35.7010200@de.ibm.com> X-Mailer: VM 7.17 under Emacs 20.7.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 688 Lines: 18 Peter Oberparleiter writes: > +static inline int addr_within_len(const void *addr, const void *start, > + size_t len) > +{ > + return ((unsigned long) addr >= (unsigned long) start) && > + ((unsigned long) addr < ((unsigned long) start + len)); > +} On most machines you'd get better code with return (unsigned long)((char*)addr - (char*)start) < (unsigned long)len; Maybe a candidate for a follow-up optimisation patch? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/