annotate osdep/swab.c @ 20649:3c3bba8c822b

intro
author michael
date Sat, 04 Nov 2006 13:33:35 +0000
parents 08cac43f1e38
children a9a7d6d85020
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16985
08cac43f1e38 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13612
diff changeset
1 #include "config.h"
13612
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
2
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
3 #ifndef HAVE_SWAB
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
4 /* system has no swab. emulate via bswap */
16985
08cac43f1e38 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13612
diff changeset
5 #include "bswap.h"
13612
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
6 #include <unistd.h>
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
7
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
8 void swab(const void *from, void *to, ssize_t n) {
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
9 const int16_t *in = (int16_t*)from;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
10 int16_t *out = (int16_t*)to;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
11 int i;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
12 n /= 2;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
13 for (i = 0 ; i < n; i++) {
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
14 out[i] = bswap_16(in[i]);
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
15 }
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
16 }
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
17 #endif