I'm trying to optimize my code and I have two bitwise questions:

I have a variable i. I am running a bitwise operation. If var1 = 0, then i = 1, if var1 = any other number, then i = 0. Would this work: i = ~(var1 & 0).

Heres my second operation:

I have a variable i. I am running a bitwise operation. If var1's 7th bit (its 0-7) = 1, then i = 128. if var1's 7th bit = 0 then i = 0.

I'm trying to avoid using if statements and am having issues with bitwise operations. Any help would be appreciated.