lkml.org 
[lkml]   [2000]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Patch to remove undefined C code
Bernd Schmidt wrote:
>
> +
> +#define ___swab64(x) \
> +({ \
> + __u64 __x = (x); \
> + ((__u64)( \
> + (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \
> + (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \
> + (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \
> + (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \
> + (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \
> + (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
> + (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
> + (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \
> +})


Isn't this more efficient?
n = (x>>32) | (x<<32);
n = ((n & 0x0000ffff0000ffffLL)<<16) | (n & 0xffff0000ffff0000LL)>>16;
n = ((n & 0x00ff00ff00ff00ffLL)<<8) | (n & 0xff00ff00ff00ff00LL)>>8;

6 shift
4 and
3 or

instead of

8 shift
8 and
7 or

--
Abramo Bagnara mailto:abramo@alsa-project.org

Opera Unica
Via Emilia Interna, 140 Phone: +39.0546.656023
48014 Castel Bolognese (RA) - Italy Fax: +39.0546.656023

ALSA project is http://www.alsa-project.org
sponsored by SuSE Linux http://www.suse.com

It sounds good!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.125 / U:0.040 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site