return to first page linux journal archive
keywordscontents

Listing 2.

u_long byterev_long (u_long L) {
 u_long mask = 0x0101010101010101;
 return (((L & (mask << 0)) << 7) | 
   ((L >> 7) & (mask << 0)) |
   ((L & (mask << 1)) << 5) |
   ((L >> 5) & (mask << 1)) |
   ((L & (mask << 2)) << 3) |
   ((L >> 3) & (mask << 2)) |
   ((L & (mask << 3)) << 1) |
   ((L >> 1) & (mask << 3)));
}