Search code examples
cghostscriptmupdf

what does x =!x means?


While readinf MuPDF comes across the source code line

x = !x;

Want to know what does the above code do?

While compilation is also gives error as

assuming signed overflow does not occur when simplifying 
condition to constant [-Werror=strict-overflow ]

Solution

  • !x will evaluate to either 0 or 1, depending on the value of x.

    • If x is 0, it evaluates to 1.
    • Otherwise, it evaluates to 0.