Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
2 | #include |
||
3 | |||
4 | void |
||
5 | swab(const void *from, void *to, int n) |
||
6 | { |
||
7 | unsigned long temp; |
||
8 | const char* fromc = from; |
||
9 | char* toc = to; |
||
10 | |||
11 | n >>= 1; n++; |
||
12 | #define STEP temp = *fromc++,*toc++ = *fromc++,*toc++ = temp |
||
13 | /* round to multiple of 8 */ |
||
14 | while ((--n) & 07) |
||
15 | STEP; |
||
16 | n >>= 3; |
||
17 | while (--n >= 0) { |
||
18 | STEP; STEP; STEP; STEP; |
||
19 | STEP; STEP; STEP; STEP; |
||
20 | } |
||
21 | } |