move to constant-time compare