diff --git a/pygsti/evotypes/densitymx/effectcreps.cpp b/pygsti/evotypes/densitymx/effectcreps.cpp index bb4ab9f77..d8c00c8c3 100644 --- a/pygsti/evotypes/densitymx/effectcreps.cpp +++ b/pygsti/evotypes/densitymx/effectcreps.cpp @@ -147,7 +147,7 @@ namespace CReps_densitymx { finalIndx += ((finds >> k) & 1) * 3 * base; base = base >> 2; // /= 4 so base == 4**(N-1-k) } - + //Apply result if(parity(finds & _zvals_int)) ret -= _abs_elval * state->_dataptr[finalIndx]; // minus sign @@ -157,15 +157,25 @@ namespace CReps_densitymx { return ret; } - INT EffectCRep_Computational::parity(INT x) { - // int64-bit specific - x = (x & 0x00000000FFFFFFFF)^(x >> 32); - x = (x & 0x000000000000FFFF)^(x >> 16); - x = (x & 0x00000000000000FF)^(x >> 8); - x = (x & 0x000000000000000F)^(x >> 4); - x = (x & 0x0000000000000003)^(x >> 2); - x = (x & 0x0000000000000001)^(x >> 1); - return x & 1; // return the last bit (0 or 1) +// INT EffectCRep_Computational::parity(INT x) { +// // int64-bit specific +// x = (x & 0x00000000FFFFFFFF)^(x >> 32); +// x = (x & 0x000000000000FFFF)^(x >> 16); +// x = (x & 0x00000000000000FF)^(x >> 8); +// x = (x & 0x000000000000000F)^(x >> 4); +// x = (x & 0x0000000000000003)^(x >> 2); +// x = (x & 0x0000000000000001)^(x >> 1); +// return x & 1; // return the last bit (0 or 1) +// } + + inline INT EffectCRep_Computational::parity(INT x) { + x ^= (x >> 32); + x ^= (x >> 16); + x ^= (x >> 8); + x ^= (x >> 4); + x ^= (x >> 2); + x ^= (x >> 1); + return x & 1; // Return the last bit }