I am doing some bit-fiddling that only works on a 2s-complement CPU. I would like to add a static_assert to the code, just in case. (Wikipedia Ones' complement page says that only some Univac machines still use 1s-complement, but I want to be paranoid.) Is this code bullet-proof, standard-conforming, and reasonable?
static_assert(~0 == -1, "2s-complement CPU required");
// note the tilde versus the minus sign
I do not have access to a 1s-complement machine. Is anyone with such willing to test this?