From e56f8156bc0efe2a5d505c57514b0956d20329b4 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 5 Mar 2017 11:36:05 -0500 Subject: [PATCH] make priority a const fn --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 62dd508747..6943b6ee62 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -164,7 +164,7 @@ unsafe impl Sync for Resource {} /// With NVIC priorities, `32` has LOWER priority than `16`. (Also, NVIC /// priorities encode the actual priority in the highest bits of a byte so /// priorities like `1` and `2` aren't actually different) -// TODO review the handling extreme value -pub fn priority(logical: u8) -> u8 { +// TODO review the handling of extreme values +pub const fn priority(logical: u8) -> u8 { ((1 << PRIORITY_BITS) - logical) << (8 - PRIORITY_BITS) }