#calculate #obtain #numbers #formula #bit #macro #calculations

macro calculate-macro

Expand the bit number of the parameters in the calculation formula to obtain the result with the expected bit number

1 unstable release

new 0.1.0 Nov 17, 2024

#552 in Procedural macros

Download history 52/week @ 2024-11-11

52 downloads per month

Apache-2.0

8KB
126 lines

Expand the bit number of the parameters in the calculation formula to obtain the result with the expected bit number.

let a = u8::MAX;
let b = u16::MAX;
let result = calc!(a + b; u32);
assert_eq!(result, 65790u32);

Dependencies

~1.5MB
~37K SLoC