summaryrefslogtreecommitdiff
path: root/include/linux/mman.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mman.h')
-rw-r--r--include/linux/mman.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/mman.h b/include/linux/mman.h
index cfb6ac61bbde..07da84fcbd15 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -28,8 +28,13 @@ static inline void vm_unacct_memory(long pages)
vm_acct_memory(-pages);
}
-/* Optimisation macro. */
-#define _calc_vm_trans(x,bit1,bit2) \
+/*
+ * Optimisation macro. It is equivalent to:
+ * (x & bit1) ? bit2 : 0
+ * but this version is faster.
+ * ("bit1" and "bit2" must be single bits)
+ */
+#define _calc_vm_trans(x, bit1, bit2) \
((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \
: ((x) & (bit1)) / ((bit1) / (bit2)))