You can use +% to have a fully defined wraparound addition: https://ziglang.org/documentation/master/#Wrapping-Operation.... For lshift, there is @shlWithOverflow.
[0] https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins...
[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.63/h...
I don't imagine it's possible to check using a static assert, either.