Comment by tromp
10 hours ago
One of the main instruments of obfuscation (and the way to get more out of the size constraints) is making the code as short as possible, so in that example you'd prefer
if (!(x/2-1)) { ...
EDIT: Oops, confused the original with x==2 || x==3. Instead, we can use !(x-1>>1), which precedence rules parse as !((x-1)>>1).
I checked this in an online C-compiler and it is not equivalent to x==1 | x==2.
this statement is equivalent to x==2 | x==3.
For example, x=3, 3/2 = 1 then 1-1 = 0 so that !(0) is 1 or true. Also for x=1, 1/2 = 0 then 0-1 = -1 and !(-1) = 0 or false.
I agree with your point in general though about size constraints.
extrano84 already found some errors but also 0 will fail and if x is int (instead of unsigned int) all negative numbers will also fail (but so will the original s-macke obfuscation as well).
It's pretty easy to see what that does though, even if it is shorter. Wouldn't the other approach be more obfuscated?