liberty/support/specpriv-smtx-executive/smtx/units.cpp
/*
 * Description:
 *
 *  Temporarily store the packet into a buffer
 *
 * Arguments:
 *
 *  buf - a packet buffer
 *  index - an index of the buffer
 *  p - a packet to be stored
 */
Temporarily store the packet into a buffer



a packet buffer
index - an index of the buffer
p - a packet to be stored
Temporarily store the packet into a buffer a packet buffer index - an index of the buffer p - a packet to be stored
static unsigned buffer_packet(packet* buf, unsigned buf_index, packet* p)
{
  if ( buf_index == PACKET_POOL_SIZE )
  {
    forward_values_to_commit( PREFIX(my_worker_id)(), buf, PACKET_POOL_SIZE );
    buf_index = 0;
  }
  buf[buf_index].ptr = p->ptr;
  buf[buf_index].value = p->value;
  buf[buf_index].size = p->size;
  buf[buf_index].is_write = p->is_write;
  buf[buf_index].type = p->type;
  buf[buf_index].sign = p->sign;
  DBG("\tbuf_packet, index %u\n", buf_index);
  return buf_index + 1;
}
static unsigned buffer_packet ( packet * buf , unsigned buf_index , packet * p ) { if ( buf_index == PACKET_POOL_SIZE ) { forward_values_to_commit ( PREFIX ( my_worker_id ) ( ) , buf , PACKET_POOL_SIZE ) ; buf_index = 0 ; } buf [ buf_index ] . ptr = p -> ptr ; buf [ buf_index ] . value = p -> value ; buf [ buf_index ] . size = p -> size ; buf [ buf_index ] . is_write = p -> is_write ; buf [ buf_index ] . type = p -> type ; buf [ buf_index ] . sign = p -> sign ; DBG ( " \t \n " , buf_index ) ; return buf_index + 1 ; }
Description:
  Temporarily store the packet into a buffer
Description : Temporarily store the packet into a buffer
//assert( buf_index < PACKET_POOL_SIZE && "packet buffer overflowed" );