0 Members and 1 Guest are viewing this topic.
z = 1110o = 0001set: { 0001 }z = 1111o = 0011set: { 0000, 0001, 0010, 0011 }z = 1111o = 1110set: even numbers
(z1, o1) | (z2, o2) = (z1 & z2, o1 | o2)(z1, o1) & (z2, o2) = (z1 | z2, o1 & o2)(z1, o1) ^ (z2, o2) = ((z1 & z2) | (o1 & o2), (z1 & o2) | (o1 & z2))
m = 1111v = 0101set: { 0101 }m = 1001v = 0000set: { 0000, 0010, 0100, 0110 }m = 0001v = 0000set: even numbers
(m1, v1) | (m2, v2) = ((m1 & m2) | v1 | v2, v1 | v2) // both known or one of them is 1(m1, v1) & (m2, v2) = ((m1 & m2) | (m1 ^ v1) | (m2 ^ v2), v1 & v2) // both known or one of them is 0(m1, v1) ^ (m2, v2) = (m1 & m2, (v1 ^ v2) & m1 & m2)
uint abm = m1 & b2;uint knownzero = m1 ^ v1 | m2 ^ v2;uint knownone = v1 | v2;uint cm = 1 | ((abm & ~(v1 ^ v2)) << 1);uint cv = (v1 & v2) << 1;uint m = 0;for (int i = 0; i < 32; i++){ uint e = cm & abm; m |= e; uint t = (cm & cv & knownone) << 1; cm |= ((e | cm & ~cv & knownzero) << 1) | t; cv |= t;}v = v1 + v2;
(m1, v1) + (m2, v2) = (~(v1 + v2) ^ ((v1 | ~m1) + (v2 | ~m2)), v1 + v2)
;(x & a) + (y & b);Inputs:; a,b c = a|b d = 1 for(i=1;i<32;i++) d=2*d if (0 == (c&d) ) c = c | ( d & ((a & (d-1)) + (b & (d-1))))
;(x & a) + (y & b);Inputs:; a,b c = a|b d = 0 for(i=1;i<32;i++) d=2*d+1 c = c | ( (d+1) & ((a & d) + (b & d-)))
uint an = ~av & am;uint bn = ~bv & bm;uint g0 = an & bn;uint g1 = av & bv;uint p0 = an ^ bn;uint pg1 = av | bv;uint g0l = ~g0 & ((g0 << 1) | 1);uint g1f = g1 & ~(g1 << 1);uint nc = (p0 + g0l & ~p0) - g0l | g0;uint m1 = ~pg1 | (pg1 & g1f);uint c = (pg1 + g1f & m1) - g1f;uint cm = (c | nc) << 1 | 1;uint m = cm & am & bm;uint v = av + bv;