[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <18501.2572.137148.78927@harpo.it.uu.se>
Date: Tue, 3 Jun 2008 11:08:28 +0200
From: Mikael Pettersson <mikpe@...uu.se>
To: Peter Oberparleiter <peter.oberparleiter@...ibm.com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Harvey Harrison <harvey.harrison@...il.com>,
Peter Oberparleiter <oberparleiter@...glemail.com>
Subject: Re: [RFC PATCH] consolidate within() implementations
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists