<< " tempResult |= 0x8;\n"
<< " for (uint i = 0; i < 128; i++)\n"
<< " {\n"
- << " bool shouldBeZero = (i >= inclusiveOffset);\n"
+ << " uint ref = inclusiveOffset - min(inclusiveOffset, i);\n"
<< " uvec4 b = MAKE_HIGH_BALLOT_RESULT(i);\n"
<< " uint inclusiveBitCount = subgroupBallotInclusiveBitCount(b);\n"
- << " if (shouldBeZero && (0 != inclusiveBitCount))\n"
- << " {\n"
- << " tempResult &= ~0x8;\n"
- << " }\n"
- << " else if (!shouldBeZero && (0 == inclusiveBitCount))\n"
+ << " if (inclusiveBitCount != ref)\n"
<< " {\n"
<< " tempResult &= ~0x8;\n"
<< " }\n"
<< " tempResult |= 0x8;\n"
<< " for (uint i = 0; i < 128; i++)\n"
<< " {\n"
- << " bool shouldBeZero = (i >= exclusiveOffset);\n"
+ << " uint ref = exclusiveOffset - min(exclusiveOffset, i);\n"
<< " uvec4 b = MAKE_HIGH_BALLOT_RESULT(i);\n"
<< " uint exclusiveBitCount = subgroupBallotExclusiveBitCount(b);\n"
- << " if (shouldBeZero && (0 != exclusiveBitCount))\n"
- << " {\n"
- << " tempResult &= ~0x4;\n"
- << " }\n"
- << " else if (!shouldBeZero && (0 == exclusiveBitCount))\n"
+ << " if (exclusiveBitCount != ref)\n"
<< " {\n"
<< " tempResult &= ~0x8;\n"
<< " }\n"