inline void asm_version(char* s)
{
   asm (
       "movl  (%%eax), %%ebx\n\t"
       "movl 4(%%eax), %%ecx\n\t"
       "bswap %%ebx\n\t"
       "bswap %%ecx\n\t"
       "movl %%ecx, (%%eax)\n\t"
       "movl %%ebx, 4(%%eax)\n\t"
       "movl 8(%%eax), %%ebx\n\t"
       "movl 12(%%eax), %%ecx\n\t"
       "bswap %%ebx\n\t"
       "bswap %%ecx\n\t"
       "movl %%ecx, 8(%%eax)\n\t"
       "movl %%ebx, 12(%%eax)\n\t"
      :
      : "a" (s)
      : "%ecx", "%ebx");
}

This is only slightly faster than...

inline void ink_port_8_swap_inplace(void *src)
{
   unsigned long long b = bswap_64(*(unsigned long long*)src);
   *(unsigned long long*)src = b;
}

-- MattWalsh - 23 Feb 2006

Topic revision: r1 - 24 Feb 2006 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback