Refactor bitwise operation circuits and tests.