예제 #1
0
파일: swap.c 프로젝트: TronicLabs/sdcc
static void testSwap_4(void)
{
    volatile unsigned char t=TEST_VECT_8;
    unsigned char tt;

    tt = t;
    tt = SWAP_4(tt);
    ASSERT( tt == SWAP_4(TEST_VECT_8));
}
예제 #2
0
void
pSwap4 (
  register MQ_INT *i
)
{
  SWAP_4 ((MQ_BIN) i);
}
예제 #3
0
static void
sSwapDYN (
  register MQ_BIN ist
)
{
  MQ_INT numItems = 0, len = 0;
  MQ_BINB type;

  // BDY_NumItems_S
  SWAP_4 (ist);
  memcpy(&numItems, ist, sizeof(MQ_INT));

  // for all Element's
  ist += (HDR_INT_LEN + 1);
  while (numItems) {

    // type
    type = *ist;
    ist += 2;

    // len
    len = (type & MQ_TYPE_IS_NATIVE);
    if (len == 0) {
      SWAP_4 (ist);
      memcpy(&len, ist, sizeof(MQ_INT));
      ist += (HDR_INT_LEN + 1);
    }

    // val
    switch ((enum MqTypeE)type) {
      case MQ_SRTT: SWAP_2  (ist);  break;
      case MQ_INTT: SWAP_4  (ist);  break;
      case MQ_FLTT: SWAP_4  (ist);  break;
      case MQ_WIDT: SWAP_8  (ist);  break;
      case MQ_DBLT: SWAP_8  (ist);  break;
      case MQ_STRT: case MQ_BINT: case MQ_BYTT: case MQ_BOLT: case MQ_TRAT: break;
      case MQ_LSTT: sSwapDYN (ist); break;
    }
    ist += (len + 1);
    numItems--;
  }
}