| 66 | //Provide a swab() impl. from glibc, for platforms that don't have one |
| 67 | #if !HAVE_SWAB || NEEDS_SWAB_IMPL |
| 68 | void swab(const void* bfrom, void* bto, ssize_t n) |
| 69 | { |
| 70 | const char* from = (const char*)bfrom; |
| 71 | char* to = (char*)bto; |
| 72 | |
| 73 | n &= ~((ssize_t)1); |
| 74 | while (n > 1) |
| 75 | { |
| 76 | const char b0 = from[--n], b1 = from[--n]; |
| 77 | to[n] = b0; |
| 78 | to[n + 1] = b1; |
| 79 | } |
| 80 | } |
| 81 | #endif |
| 82 | |
| 83 | // forwards |