Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Sharlin
· 1y ago · 0 comments
Rust has some precedence for adding convenience newtypes with overloaded operators (eg. `Wrapping<I>´ for `I.wrapping_add(I)` etc). Such a wrapper isn't currently proposed AFAIK but there's no reason one couldn't be added in the future I believe.
Comments
[–]
Measter
1y ago
For giggles, here's one I whipped up, along with an example use:
https://godbolt.org/z/Eezj35dzc
[–]
eqvinox
1y ago
Having done unspeakable things with the C preprocessor myself, this Rust macro soup truly warms my heart <3
[–]
Measter
1y ago
Oh this is simple, this is just a bit of basic expansion to generate boilerplate. The real experts can do some gnarly and amazing stuff with macros.
[–]
Sharlin
OP
1y ago
Wow, that's some hardcore unrolling.
[–]
eqvinox
1y ago
Right, as long as the LLVM intrinsics are exposed you could just put that in a crate somewhere.