1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 /** \file
18  * \ingroup bli
19  */
20 
21 #include "BLI_endian_switch.h"
22 #include "BLI_sys_types.h"
23 #include "BLI_utildefines.h"
24 
BLI_endian_switch_int16_array(short * val,const int size)25 void BLI_endian_switch_int16_array(short *val, const int size)
26 {
27   if (size > 0) {
28     int i = size;
29     while (i--) {
30       BLI_endian_switch_int16(val++);
31     }
32   }
33 }
34 
BLI_endian_switch_uint16_array(unsigned short * val,const int size)35 void BLI_endian_switch_uint16_array(unsigned short *val, const int size)
36 {
37   if (size > 0) {
38     int i = size;
39     while (i--) {
40       BLI_endian_switch_uint16(val++);
41     }
42   }
43 }
44 
BLI_endian_switch_int32_array(int * val,const int size)45 void BLI_endian_switch_int32_array(int *val, const int size)
46 {
47   if (size > 0) {
48     int i = size;
49     while (i--) {
50       BLI_endian_switch_int32(val++);
51     }
52   }
53 }
54 
BLI_endian_switch_uint32_array(unsigned int * val,const int size)55 void BLI_endian_switch_uint32_array(unsigned int *val, const int size)
56 {
57   if (size > 0) {
58     int i = size;
59     while (i--) {
60       BLI_endian_switch_uint32(val++);
61     }
62   }
63 }
64 
BLI_endian_switch_float_array(float * val,const int size)65 void BLI_endian_switch_float_array(float *val, const int size)
66 {
67   if (size > 0) {
68     int i = size;
69     while (i--) {
70       BLI_endian_switch_float(val++);
71     }
72   }
73 }
74 
BLI_endian_switch_int64_array(int64_t * val,const int size)75 void BLI_endian_switch_int64_array(int64_t *val, const int size)
76 {
77   if (size > 0) {
78     int i = size;
79     while (i--) {
80       BLI_endian_switch_int64(val++);
81     }
82   }
83 }
84 
BLI_endian_switch_uint64_array(uint64_t * val,const int size)85 void BLI_endian_switch_uint64_array(uint64_t *val, const int size)
86 {
87   if (size > 0) {
88     int i = size;
89     while (i--) {
90       BLI_endian_switch_uint64(val++);
91     }
92   }
93 }
94 
BLI_endian_switch_double_array(double * val,const int size)95 void BLI_endian_switch_double_array(double *val, const int size)
96 {
97   if (size > 0) {
98     int i = size;
99     while (i--) {
100       BLI_endian_switch_double(val++);
101     }
102   }
103 }
104