annotate osdep/swab.c @ 32971:dc905c693b7a

Choose informative variable names. That way, a comment on the variable isn't longer necessary.
author ib
date Tue, 08 Mar 2011 19:07:55 +0000
parents 5cfef41a1771
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28744
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
1 /*
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
2 * This file is part of MPlayer.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
3 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
5 * it under the terms of the GNU General Public License as published by
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
7 * (at your option) any later version.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
8 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
12 * GNU General Public License for more details.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
13 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
14 * You should have received a copy of the GNU General Public License along
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
17 */
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
18
16985
08cac43f1e38 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13612
diff changeset
19 #include "config.h"
13612
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
20
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
21 /* system has no swab. emulate via bswap */
21852
a9a7d6d85020 bswap.h --> mpbswap.h
diego
parents: 16985
diff changeset
22 #include "mpbswap.h"
13612
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
23 #include <unistd.h>
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
24
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
25 void swab(const void *from, void *to, ssize_t n) {
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
26 const int16_t *in = (int16_t*)from;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
27 int16_t *out = (int16_t*)to;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
28 int i;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
29 n /= 2;
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
30 for (i = 0 ; i < n; i++) {
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
31 out[i] = bswap_16(in[i]);
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
32 }
c0bde085511c Zeta OS support, mostly working.
reimar
parents:
diff changeset
33 }