[Liboil] another copy_u8 for the pot

Adam D. Moss adam at gimp.org
Wed Nov 16 03:45:17 PST 2005


A minor variation on copy_u8_ints, of course, but rather
faster here...

static void
copy_u8_llints (uint8_t *dest, uint8_t *src, int n)
{
   int i;
   for(i=0;i<(n&7);i++){
     *dest++ = *src++;
   }
   n >>= 3;
   for(i=0;i<n;i++){
     *(uint64_t *)dest = *(uint64_t *)src;
     dest += 8;
     src += 8;
   }
}
OIL_DEFINE_IMPL (copy_u8_llints, copy_u8);

One concern is that both of these routines potentially
cause unaligned accesses, which are fatal on some archs
and incredibly slow on others (safe and merely slightly
slower on x86).

--adam
-- 
Adam D. Moss   -   adam at gimp.org


More information about the Liboil mailing list