Why not use: x = !x;?

Yes, but while it is much faster than using the Arduino digital i/o it is stepping outside of Arduino and will not be portable since it is not using the portable Arduino digital pin i/o abstraction API.

--- bill