diff options
author | 2021-07-20 08:51:53 +0000 | |
---|---|---|
committer | 2021-07-20 08:51:53 +0000 | |
commit | 78f556f9427e94e830b6ff6269bb1ac80010c5e6 (patch) | |
tree | 9db41cca23a87a9d78369c14b311d7fda9309fc0 /macros/src/codegen/util.rs | |
parent | c67657371b9f27353caae8a8ccf6e94cd0f25110 (diff) | |
parent | bf80035aef21dd9c84a26ed47bbd1bb4a596952f (diff) | |
download | rtic-78f556f9427e94e830b6ff6269bb1ac80010c5e6.tar.gz rtic-78f556f9427e94e830b6ff6269bb1ac80010c5e6.tar.zst rtic-78f556f9427e94e830b6ff6269bb1ac80010c5e6.zip |
Merge #464
464: const generics r=AfoHT a=burrbull
Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com>
Co-authored-by: mriise <mark.riise26@gmail.com>
Co-authored-by: Zgarbul Andrey <zgarbul.andrey@gmail.com>
Diffstat (limited to 'macros/src/codegen/util.rs')
-rw-r--r-- | macros/src/codegen/util.rs | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs index 86bd6955..c2330d46 100644 --- a/macros/src/codegen/util.rs +++ b/macros/src/codegen/util.rs @@ -8,23 +8,10 @@ use syn::{Attribute, Ident, LitInt, PatType}; use crate::check::Extra; /// Turns `capacity` into an unsuffixed integer literal -pub fn capacity_literal(capacity: u8) -> LitInt { +pub fn capacity_literal(capacity: usize) -> LitInt { LitInt::new(&capacity.to_string(), Span::call_site()) } -/// Turns `capacity` into a type-level (`typenum`) integer -pub fn capacity_typenum(capacity: u8, round_up_to_power_of_two: bool) -> TokenStream2 { - let capacity = if round_up_to_power_of_two { - capacity.checked_next_power_of_two().expect("UNREACHABLE") - } else { - capacity - }; - - let ident = Ident::new(&format!("U{}", capacity), Span::call_site()); - - quote!(rtic::export::consts::#ident) -} - /// Identifier for the free queue pub fn fq_ident(task: &Ident) -> Ident { Ident::new(&format!("{}_FQ", task.to_string()), Span::call_site()) |