From 67bc946a3940d8fcb0a45a7c886e7170446b623c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 19 May 2021 20:52:05 +0100 Subject: [PATCH] accounts: PermSet: Fix to actually shift (!) Signed-off-by: Ian Jackson --- src/accounts.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/accounts.rs b/src/accounts.rs index f51a9948..ca509f40 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -547,7 +547,7 @@ pub mod loaded_acl { { fn from(i: I) -> Self { PermSet( - i.into_iter().fold(0, |b, i| b | i.borrow().to_u64().unwrap()), + i.into_iter().fold(0, |b, i| b | 1 << (i.borrow().to_u8().unwrap())), PhantomData, ) } @@ -557,7 +557,7 @@ pub mod loaded_acl { let mut s = HashSet::new(); for n in 0.. { let v = match FromPrimitive::from_u64(n) { Some(v) => v, None => break }; - if packed.0 & n != 0 { s.insert(v); } + if packed.0 & (1 << n) != 0 { s.insert(v); } } s } -- 2.30.2