Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-03 13:03:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-03 13:03:25 +0400
commitb8b5bf7dcde37d1be38f0dbbbbf268a4c292d4d8 (patch)
tree2bb58d71255c1e68a598649608fb8a2e209ea1e8 /source/blender/blenlib
parentd248f94cf8b3a715297f3e512d0b10c7d7b7a0c1 (diff)
array functions for endian switching.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_endian_switch.h9
-rw-r--r--source/blender/blenlib/intern/endian_switch.c93
2 files changed, 102 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_endian_switch.h b/source/blender/blenlib/BLI_endian_switch.h
index 19da1ff35a3..7017e7ba789 100644
--- a/source/blender/blenlib/BLI_endian_switch.h
+++ b/source/blender/blenlib/BLI_endian_switch.h
@@ -29,5 +29,14 @@
#include "BLI_endian_switch_inline.h"
+/* endian_switch.c */
+void BLI_endian_switch_int16_array(short *val, const int size);
+void BLI_endian_switch_uint16_array(unsigned short *val, const int size);
+void BLI_endian_switch_int32_array(int *val, const int size);
+void BLI_endian_switch_uint32_array(unsigned int *val, const int size);
+void BLI_endian_switch_float_array(float *val, const int size);
+void BLI_endian_switch_int64_array(int64_t *val, const int size);
+void BLI_endian_switch_uint64_array(uint64_t *val, const int size);
+void BLI_endian_switch_double_array(double *val, const int size);
#endif /* __BLI_ENDIAN_SWITCH_H__ */
diff --git a/source/blender/blenlib/intern/endian_switch.c b/source/blender/blenlib/intern/endian_switch.c
index db4884d35b9..b9b18136863 100644
--- a/source/blender/blenlib/intern/endian_switch.c
+++ b/source/blender/blenlib/intern/endian_switch.c
@@ -23,3 +23,96 @@
/** \file blender/blenlib/intern/endian_switch.c
* \ingroup bli
*/
+
+#include "BLO_sys_types.h"
+#include "BLI_utildefines.h"
+#include "BLI_endian_switch.h"
+
+void BLI_endian_switch_int16_array(short *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_int16(val--);
+ }
+ }
+}
+
+void BLI_endian_switch_uint16_array(unsigned short *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_uint16(val--);
+ }
+ }
+}
+
+void BLI_endian_switch_int32_array(int *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_int32(val--);
+ }
+ }
+}
+
+void BLI_endian_switch_uint32_array(unsigned int *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_uint32(val--);
+ }
+ }
+}
+
+void BLI_endian_switch_float_array(float *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_float(val--);
+ }
+ }
+}
+
+void BLI_endian_switch_int64_array(int64_t *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_int64(val--);
+ }
+ }
+}
+
+void BLI_endian_switch_uint64_array(uint64_t *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_uint64(val--);
+ }
+ }
+}
+
+
+void BLI_endian_switch_double_array(double *val, const int size)
+{
+ if (size > 0) {
+ int i = size;
+ val = val + (size - 1);
+ while (i--) {
+ BLI_endian_switch_double(val--);
+ }
+ }
+}