c*******n 发帖数: 63 | 1 写个简单的第二题
void OR(Bits *out, const Bits &in1, const Bits &in2)
{
unsigned int sntnl = 1;
assert(out);
out->known = 0;
out->value = 0;
while(sntnl >0)
{
if( (in1.known&sntnl && in1.value&sntnl)
|| (in2.known&sntnl && in2.value&sntnl) )
{
out->value |= sntnl;
out->known |= sntnl;
}
else if(in1.known&sntnl && in2.known&sntnl)
{
out->known |= sntnl;
}
sntnl <<= 1;
}
} |
|