Utility function for setting state of Z and N flags