Comment by saagarjha

3 days ago

Of course this is substantially less doable in C :(

Fair point, yeah. The general concept should still apply, you could maybe wrap it in some macros, but it is going to be more awkward mostly because of the lack of operator overloading.

  • Yeah, I meant specifically C in an ergonomic way with operators working on them and being passable to existing functions.

    Though wrapping in different structs doesn't seem to even make gcc & clang properly optimize utilizing the types as non-aliasing: https://godbolt.org/z/r1MT9W9db. Clang just completely fails to do anything, but gcc somehow manages to reorder the load but not do the trivial part of constant-propagating afterwards..