diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2017-03-05 11:36:05 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2017-03-05 11:36:05 -0500 |
| commit | e56f8156bc0efe2a5d505c57514b0956d20329b4 (patch) | |
| tree | 38e5cf695a9ce98093d4a2dcb95d6340370f2d72 | |
| parent | aba93337993e6be0291199631f7ed6b0f90adf38 (diff) | |
make priority a const fn
| -rw-r--r-- | src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -164,7 +164,7 @@ unsafe impl<T> Sync for Resource<T> {} /// 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) } |
