Alexey Botchkov <[email protected]> writes:

> Only question i have with this is if there's a possibility to make the
> hf_mi_uint6korr(dest,src) macro a function.
> So we can write as usual
>     dest= hf_mi_uint6korr(src)
>
> Didn't find how that can nicely be done with the assembler code.

Do it like this:

static inline ulonglong
uint6korr(const void *p)
{
  uint32 a= *(uint32 *)p;
  uint16 b= *(uint16 *)(4+(char *)p);
  return (ulonglong)a | ((ulonglong)b << 32);
}

static inline ulonglong
mi_uint6korr(const void *p)
{
  uint32 a= *(uint32 *)p;
  uint16 b= *(uint16 *)(4+(char *)p);
  ulonglong v= ((ulonglong)a | ((ulonglong)b << 32)) << 16;
  asm ("bswapq %0" : "=r" (v) : "0" (v));
  return v;
}

I get:

elapsed 25 seconds on korr6-1
elapsed 31 seconds on korr6-2
elapsed 35 seconds on hf_korr6-1
elapsed 44 seconds on hf_korr6-2
elapsed 22 seconds on mi6-1
elapsed 38 seconds on mi6-2
elapsed 27 seconds on hf_mi6B-1
elapsed 42 seconds on hf_mi6-2

So they are even a bit faster than the macros.

 - Kristian.

_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to