Configurable quad residue check