#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

0.1.0 Nov 17, 2024

#567 in Procedural macros

Download history 104/week @ 2024-11-16 13/week @ 2024-11-23 4/week @ 2024-12-07

121 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
~38K SLoC