diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-03-05 21:41:25 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-03-05 21:41:25 +0100 |
commit | 90233c3cf84453424f1de6dd68f19255ece26f1d (patch) | |
tree | d1108e9f3a8a30e87a1a4d7ac431fab7ee9da6b0 /src/imm.rs | |
parent | 7e50574500e4c33d8f12a5cb4893249f29e311f0 (diff) | |
download | juicebox-asm-90233c3cf84453424f1de6dd68f19255ece26f1d.tar.gz juicebox-asm-90233c3cf84453424f1de6dd68f19255ece26f1d.zip |
Updated doc comments
Diffstat (limited to 'src/imm.rs')
-rw-r--r-- | src/imm.rs | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -1,3 +1,6 @@ +//! Definition of different immediate types which are used as input operands for various +//! instructions. + /// Trait to interact with immediate operands. pub(crate) trait Imm { /// Get immediate operand as slice of bytes. @@ -5,8 +8,8 @@ pub(crate) trait Imm { } macro_rules! impl_imm { - ($name:ident, $size:expr, from: $( $from:ty ),* $(,)?) => { - /// Immediate operand. + (#[$doc:meta] $name:ident, $size:expr, from: { $( $from:ty ),* $(,)? }) => { + #[$doc] pub struct $name([u8; $size]); impl Imm for $name { @@ -29,7 +32,19 @@ macro_rules! impl_imm { } } -impl_imm!(Imm8, 1, from: u8, i8); -impl_imm!(Imm16, 2, from: u16, i16, u8, i8); -impl_imm!(Imm32, 4, from: u32, i32, u16, i16, u8, i8); -impl_imm!(Imm64, 8, from: u64, i64, u32, i32, u16, i16, u8, i8); +impl_imm!( + /// Type representing an 8 bit immediate. + Imm8, 1, from: { u8, i8 } +); +impl_imm!( + /// Type representing a 16 bit immediate. + Imm16, 2, from: { u16, i16, u8, i8 } +); +impl_imm!( + /// Type representing a 32 bit immediate. + Imm32, 4, from: { u32, i32, u16, i16, u8, i8 } +); +impl_imm!( + /// Type representing a 64 bit immediate. + Imm64, 8, from: { u64, i64, u32, i32, u16, i16, u8, i8 } +); |