[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: comment opaque expression in __page_to_virt()
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1346653070 -7200 # Node ID 8fbdcc1c5613dc55c23be8b56f52a37f4d89e9fa # Parent 34e22386e7127f3ef77ac73098fc50c0fe7bab1f x86: comment opaque expression in __page_to_virt() mm.h's __page_to_virt() has a rather opaque expression. Comment it. Reported-By: Ian Campbell <ian.campbell@xxxxxxxxxx> Suggested-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> --- diff -r 34e22386e712 -r 8fbdcc1c5613 xen/include/asm-x86/mm.h --- a/xen/include/asm-x86/mm.h Fri Aug 31 21:15:31 2012 +0100 +++ b/xen/include/asm-x86/mm.h Mon Sep 03 08:17:50 2012 +0200 @@ -323,6 +323,12 @@ static inline struct page_info *__virt_t static inline void *__page_to_virt(const struct page_info *pg) { ASSERT((unsigned long)pg - FRAMETABLE_VIRT_START < FRAMETABLE_VIRT_END); + /* + * (sizeof(*pg) & -sizeof(*pg)) selects the LS bit of sizeof(*pg). The + * division and re-multiplication avoids one shift when sizeof(*pg) is a + * power of two (otherwise there would be a right shift followed by a + * left shift, which the compiler can't know it can fold into one). + */ return (void *)(DIRECTMAP_VIRT_START + ((unsigned long)pg - FRAMETABLE_VIRT_START) / (sizeof(*pg) / (sizeof(*pg) & -sizeof(*pg))) * _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |