Merge pull request #1129 from jmarshallnz/remove_smb_auth_details_in_add_source
[vuplus_xbmc] / xbmc / utils / EndianSwap.cpp
1 /*
2  *      Copyright (C) 2012 Team XBMC
3  *      http://www.xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  *  http://www.gnu.org/copyleft/gpl.html
19  */
20
21 #include "EndianSwap.h"
22
23 /* based on libavformat/spdif.c */
24 void Endian_Swap16_buf(uint16_t *dst, uint16_t *src, int w)
25 {
26   int i;
27
28   for (i = 0; i + 8 <= w; i += 8) {
29     dst[i + 0] = Endian_Swap16(src[i + 0]);
30     dst[i + 1] = Endian_Swap16(src[i + 1]);
31     dst[i + 2] = Endian_Swap16(src[i + 2]);
32     dst[i + 3] = Endian_Swap16(src[i + 3]);
33     dst[i + 4] = Endian_Swap16(src[i + 4]);
34     dst[i + 5] = Endian_Swap16(src[i + 5]);
35     dst[i + 6] = Endian_Swap16(src[i + 6]);
36     dst[i + 7] = Endian_Swap16(src[i + 7]);
37   }
38
39   for (; i < w; i++)
40     dst[i + 0] = Endian_Swap16(src[i + 0]);
41 }
42