示例#1
0
 Binary Binary::operator +(const Binary& B)
 {
   Binary sum(i+B.getInt());
   if(B.getBitSize() > sum.bitSize)
     sum.setBitSize(B.getBitSize());
   return sum;
 }
示例#2
0
 Binary Binary::operator |(const Binary& B)
 {
   Binary _or(i | B.getInt());
   if(B.getBitSize() > _or.bitSize)
     _or.setBitSize(B.getBitSize());
   return _or;
 }
示例#3
0
 Binary Binary::operator &(const Binary& B)
 {
   Binary _and(i & B.getInt());
   if(B.getBitSize() > _and.bitSize)
     _and.setBitSize(B.getBitSize());
   return _and;
 }
示例#4
0
 Binary Binary::operator -(const Binary& B)
 {
   Binary diff(i-B.i);
   if(B.getBitSize() > diff.bitSize)
     diff.setBitSize(B.getBitSize());
   return diff;
 }
示例#5
0
 Binary Binary::operator ^(const Binary& B)
 {
   Binary::value_type tempInt = i & B.i;
   Binary _xor(tempInt);
   if(B.bitSize > _xor.bitSize)
     _xor.bitSize = B.getBitSize();
   return _xor;
 }