lkml.org 
[lkml]   [2004]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[arm] __arch__swab32.
Date
This function reverses the bytes in a word.
The method was discovered in 1986 following a competition between
ARM programmers. It requires just 4 instructions and 1 work register.

unsigned long reverse(unsigned long v)
{
unsigned long t;
t = v ^ ((v << 16) | (v >> 16)); // EOR r1,r0,r0,ROR #16 [*]
t &= ~0xff0000; // BIC r1,r1,#&ff0000
v = (v << 24) | (v >> 8); // MOV r0,r0,ROR #8
return v ^ (t >> 8); // EOR r0,r0,r1,LSR #8
}

Could we use the asm. optimized version instead of the generic ___swab32?

[*] http://gcc.gnu.org/PR18560

--
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

#define say(x) lie(x)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.026 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site