lkml.org 
[lkml]   [2015]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 15/44] kdbus: Simplify bitwise expression in kdbus_meta_get_mask()
Date
Replace the expression with more concise and readable equivalent. It can
be proven by opening parentheses:

r & ~((p | i) & r) == r & (~(p | i) | ~r) ==
(r & ~(p | i)) | (r & ~r) == r & ~(p | i) == r & ~p & ~i

Signed-off-by: Sergei Zviagintsev <sergei@s15v.net>
---
ipc/kdbus/metadata.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/kdbus/metadata.c b/ipc/kdbus/metadata.c
index 788b4d9c7ecb..61215a078359 100644
--- a/ipc/kdbus/metadata.c
+++ b/ipc/kdbus/metadata.c
@@ -1321,7 +1321,7 @@ static u64 kdbus_meta_get_mask(struct pid *prv_pid, u64 prv_mask,
* the sender, but still requested by the receiver. If any are left,
* perform rather expensive /proc access checks for them.
*/
- missing = req_mask & ~((prv_mask | impl_mask) & req_mask);
+ missing = req_mask & ~prv_mask & ~impl_mask;
if (missing)
proc_mask = kdbus_meta_proc_mask(prv_pid, req_pid, req_cred,
missing);
--
1.8.3.1


\
 
 \ /
  Last update: 2015-10-08 14:01    [W:0.357 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site