// G mixing function
void G (uint ix, uint iy, uint a, uint b, uint c, uint d) {
+ bool carry;
uint o0;
uint o1;
uint xor0;
// a = a + b;
o0 = v[a] + v[b];
o1 = v[a+1u] + v[b+1u];
- if (v[a] > 0xFFFFFFFFu - v[b]) {
- o1 = o1 + 1u;
- }
+ carry = o0 < v[a];
+ o1 = o1 + uint(mix(0.0, 1.0, float(carry)));
v[a] = o0;
v[a+1u] = o1;
// a = a + m[sigma[r][2*i+0]];
o0 = v[a] + m[ix];
o1 = v[a+1u] + m[ix+1u];
- if (v[a] > 0xFFFFFFFFu - m[ix]) {
- o1 = o1 + 1u;
- }
+ carry = o0 < v[a];
+ o1 = o1 + uint(mix(0.0, 1.0, float(carry)));
v[a] = o0;
v[a+1u] = o1;
// c = c + d;
o0 = v[c] + v[d];
o1 = v[c+1u] + v[d+1u];
- if (v[c] > 0xFFFFFFFFu - v[d]) {
- o1 = o1 + 1u;
- }
+ carry = o0 < v[c];
+ o1 = o1 + uint(mix(0.0, 1.0, float(carry)));
v[c] = o0;
v[c+1u] = o1;
// a = a + b;
o0 = v[a] + v[b];
o1 = v[a+1u] + v[b+1u];
- if (v[a] > 0xFFFFFFFFu - v[b]) {
- o1 = o1 + 1u;
- }
+ carry = o0 < v[a];
+ o1 = o1 + uint(mix(0.0, 1.0, float(carry)));
v[a] = o0;
v[a+1u] = o1;
// a = a + m[sigma[r][2*i+1]];
o0 = v[a] + m[iy];
o1 = v[a+1u] + m[iy+1u];
- if (v[a] > 0xFFFFFFFFu - m[iy]) {
- o1 = o1 + 1u;
- }
+ carry = o0 < v[a];
+ o1 = o1 + uint(mix(0.0, 1.0, float(carry)));
v[a] = o0;
v[a+1u] = o1;
// c = c + d;
o0 = v[c] + v[d];
o1 = v[c+1u] + v[d+1u];
- if (v[c] > 0xFFFFFFFFu - v[d]) {
- o1 = o1 + 1u;
- }
+ carry = o0 < v[c];
+ o1 = o1 + uint(mix(0.0, 1.0, float(carry)));
v[c] = o0;
v[c+1u] = o1;