Skip to content

Commit 78f93dd

Browse files
committed
cpubits: add 16 vs 32 and 32 vs 64-bit patterns
For use cases where one of the three sizes won't be supported (either 16-bit or 64-bit), allows matching against only two of the three options
1 parent aee59b6 commit 78f93dd

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

cpubits/src/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,30 @@ macro_rules! cpubits {
197197
}
198198
};
199199

200+
// Select between 16-bit and 32-bit options, where no code will be generated for 64-bit targets
201+
(
202+
16 => { $( $tokens16:tt )* }
203+
32 => { $( $tokens32:tt )* }
204+
) => {
205+
$crate::cpubits! {
206+
16 => { $( $tokens16 )* }
207+
32 => { $( $tokens32 )* }
208+
64 => { }
209+
}
210+
};
211+
212+
// Select between 32-bit and 64-bit options, where no code will be generated for 16-bit targets
213+
(
214+
32 => { $( $tokens32:tt )* }
215+
64 => { $( $tokens64:tt )* }
216+
) => {
217+
$crate::cpubits! {
218+
16 => { }
219+
32 => { $( $tokens32 )* }
220+
64 => { $( $tokens64 )* }
221+
}
222+
};
223+
200224
// Select between 16-bit and 32-bit options, where 64-bit will use the 32-bit option
201225
(
202226
16 => { $( $tokens16:tt )* }

0 commit comments

Comments
 (0)