login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
August
»
19
Re: [RFC][PATCH] introduce ptr_diff()
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: David Howells
Subject:
Re: [RFC][PATCH] introduce ptr_diff()
Date: Thursday, August 19, 2010 - 5:03 am
Namhyung Kim <namhyung@gmail.com> wrote:
quoted text
> + if (is_power_of_2(__size)) \ > + __diff = (__addr1 - __addr2) >> ilog2(__size); \ > + else \ > + __diff = (__addr1 - __addr2) / __size; \
You shouldn't need to do this. The compiler's optimiser should switch a divide to a shift for a power-of-2 divisor. David --
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[RFC][PATCH] introduce ptr_diff()
, Namhyung Kim
, (Thu Aug 19, 4:37 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Bernd Petrovitsch
, (Thu Aug 19, 4:57 am)
Re: [RFC][PATCH] introduce ptr_diff()
, David Howells
, (Thu Aug 19, 5:03 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Andi Kleen
, (Thu Aug 19, 5:23 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Matthew Wilcox
, (Thu Aug 19, 5:40 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Bernd Petrovitsch
, (Thu Aug 19, 5:48 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Andi Kleen
, (Thu Aug 19, 5:58 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Andi Kleen
, (Thu Aug 19, 5:59 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Bernd Petrovitsch
, (Thu Aug 19, 6:05 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Andi Kleen
, (Thu Aug 19, 6:39 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Namhyung Kim
, (Thu Aug 19, 8:53 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Bernd Petrovitsch
, (Thu Aug 19, 9:04 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Namhyung Kim
, (Thu Aug 19, 9:12 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Måns Rullgård
, (Thu Aug 19, 9:18 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Al Viro
, (Fri Aug 20, 5:07 am)
Re: [RFC][PATCH] introduce ptr_diff()
, Al Viro
, (Fri Aug 20, 5:12 am)
Re: [RFC][PATCH] introduce ptr_diff()