summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-01-31 15:28:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-01-31 15:28:40 (GMT)
commit6cf56ca817ccba7b8c956cffee208ec624921b12 (patch)
treee30ab953bdfc4d332ea6c0af192f8ae4893931b3 /src/H5T.c
parenteb4cc0556c390deaa9f21710d95f5690932221d9 (diff)
downloadhdf5-6cf56ca817ccba7b8c956cffee208ec624921b12.zip
hdf5-6cf56ca817ccba7b8c956cffee208ec624921b12.tar.gz
hdf5-6cf56ca817ccba7b8c956cffee208ec624921b12.tar.bz2
[svn-r8136] Purpose:
Optimization Description: Speed up various parts of the library by setting a global variable for the endianness of the machine at library startup and use that variable instead of repeatedly querying the endianness of the native int datatype. Platforms tested: IBM p690 (copper) too minor to require h5committest
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 6f670b0..f10752d 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -241,6 +241,9 @@ static struct {
H5T_soft_t *soft; /*unsorted array of soft conversions */
} H5T_g;
+/* The native endianess of the platform */
+H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR;
+
/* The overflow handler */
H5T_overflow_t H5T_overflow_g = NULL;
@@ -514,7 +517,7 @@ H5T_init_inf(void)
dst = &dst_p->u.atomic;
/* Check that we can re-order the bytes correctly */
- if (H5T_ORDER_LE!=dst->order && H5T_ORDER_BE!=dst->order)
+ if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g)
HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
/* +Inf */
@@ -524,7 +527,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->size-(u+1)];
@@ -540,7 +543,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->size-(u+1)];
@@ -555,7 +558,7 @@ H5T_init_inf(void)
dst = &dst_p->u.atomic;
/* Check that we can re-order the bytes correctly */
- if (H5T_ORDER_LE!=dst->order && H5T_ORDER_BE!=dst->order)
+ if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g)
HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
/* +Inf */
@@ -565,7 +568,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->size-(u+1)];
@@ -581,7 +584,7 @@ H5T_init_inf(void)
H5T_bit_set (d, dst->u.f.mpos, dst->u.f.msize, FALSE);
/* Swap the bytes if the machine architecture is big-endian */
- if (H5T_ORDER_BE==dst->order) {
+ if (H5T_ORDER_BE==H5T_native_order_g) {
half_size = dst_p->size/2;
for (u=0; u<half_size; u++) {
uint8_t tmp = d[dst_p->size-(u+1)];