Ejemplo n.º 1
0
void
FieldInstruction::encodeSignedInteger(DataDestination & destination, WorkingBuffer & buffer, int64 value)
{
  if (value >= 0)
  {
    if (value < 0x0000000000000040LL)
    {
      destination.putByte(((value & 0x7F) | 0x80)); // .... .... .... ..7f
    }
    else if (value < 0x0000000000002000LL)
    {
      destination.putByte(((value >> 7)   & 0x7F)); // .... .... .... 3F8.
      destination.putByte(((value & 0x7F) | 0x80)); // .... .... .... ..7f
    }
    else if (value < 0x0000000000100000LL)
Ejemplo n.º 2
0
void
FieldInstruction::encodeSignedInteger(DataDestination & destination, WorkingBuffer & buffer, int64 value)
{
  encodeToWorkingBuffer(buffer, value);
  for(const uchar * it = buffer.begin();
    it != buffer.end();
    ++it)
  {
    destination.putByte(*it);
  }
}
Ejemplo n.º 3
0
void
PresenceMap::encode(DataDestination & destination)
{
  if(bytePosition_ == 0 && bitMask_ == startByteMask)
  {
    return;
  }
  size_t bpos = bytePosition_;
  // if the last byte is unused, don't write it.
  if(bitMask_ == startByteMask)
  {
    bpos -= 1;
  }
  while(bpos > 0 && bits_[bpos] == 0)
  {
    bpos--;
  }
  bits_[bpos] |= stopBit;
  for(size_t pos = 0; pos <= bpos; ++pos)
  {
    destination.putByte(bits_[pos]);
  }
  if(vout_)
  {
    (*vout_) << "pmap["  <<  bpos << "]->" << std::hex;
    for(size_t pos = 0; pos <= bpos; ++pos)
    {
      (*vout_) << ' ' << std::setw(2) << static_cast<unsigned short>(bits_[pos]);
    }
    (*vout_) << " = ";
    for(size_t pos = 0; pos <= bpos; ++pos)
    {
      uchar byte = bits_[pos];
      for(uchar mask = startByteMask; mask != 0; mask >>= 1)
      {
        (*vout_) << ((byte & mask) ? 'T' : 'f');
      }
    }

    (*vout_) << std::dec << std::endl;
  }
}