From 62f75b2956e49a7c3aa58ac642f9acad193a2ac0 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 4 Oct 2003 21:03:09 -0700 Subject: [PATCH] [PATCH] document the macro for translating PROT_ to VM_ bits From: Muli Ben-Yehuda Shed some much-needed light. --- include/linux/mman.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/mman.h b/include/linux/mman.h index cfb6ac61bbdef..07da84fcbd153 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))) -- 2.53.0