Branch: Tag:

2015-08-05

2015-08-05 22:53:56 by Per Hedbor <ph@opera.com>

Use the set_unaligned16/32 function

755:       static void io_append_short_uc( Buffer *io, unsigned short shrt )    { -  if (((ptrdiff_t)(io->buffer + io->len)) & 1) { -  /* Unaligned access. */ -  unsigned short tmp = htons(shrt); -  memcpy(io->buffer+io->len, &tmp, 2); -  } else { -  *((short *)(io->buffer+io->len)) = htons(shrt); -  } +  set_unaligned16( io->buffer+io->len, htons(shrt));    io->len+=2;    }       static void io_append_int_uc( Buffer *io, unsigned INT32 i )    { -  if (((ptrdiff_t)(io->buffer + io->len)) & 3) { -  /* Unaligned access. */ -  unsigned INT32 tmp = htonl(i); -  memcpy(io->buffer+io->len, &tmp, 4); -  } else { -  *((INT32 *)(io->buffer+io->len)) = htonl(i); -  } +  set_unaligned32( io->buffer+io->len, htonl(i));    io->len+=4;    }