[asterisk-users] Use the NEW ulaw/alaw codecs (slower, but cleaner)

Benny Amorsen benny+usenet at amorsen.dk
Tue Nov 18 13:59:19 CST 2008


Interestingly the Linux kernel has this for find-last-set:

static inline unsigned long __fls(unsigned long word)
{
       asm("bsr %1,%0"
           :"=r" (word)
           :"rm" (word));
       return word;
}

spandsp has this (Everything non-x86 has been removed):

static __inline__ int top_bit(unsigned int bits)
{
    int res;

    __asm__ (" xorl %[res],%[res];\n"
             " decl %[res];\n"
             " bsrl %[bits],%[res]\n"
             : [res] "=&r" (res)
             : [bits] "rm" (bits));
    return res;
}

I haven't measured which one is best.


/Benny




More information about the asterisk-users mailing list