summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-06-24 20:10:36 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-06-24 20:10:36 (GMT)
commite3a8e61c26cd280a74d27340ade9d34a51fdde94 (patch)
treef10419a8713bfea1ffe4e43b70758dd91a5843e3 /src
parent90f8e6c9f7eb8d7200e6a7500dfa1c64d364b305 (diff)
downloadhdf5-e3a8e61c26cd280a74d27340ade9d34a51fdde94.zip
hdf5-e3a8e61c26cd280a74d27340ade9d34a51fdde94.tar.gz
hdf5-e3a8e61c26cd280a74d27340ade9d34a51fdde94.tar.bz2
[svn-r7097] Purpose:
Bug fix Description: Alignment of some types (namely 'short's) was still not being correctly detected on some Crays. Solution: Revert part of last change which accidentally got the offset of 'short's wrong on Crays Correct check for alignment of 'short's on Crays. Platforms tested: FreeBSD 4.8 (sleipnir) h5committest Cray SV1 (wind) Cray T3E (hubble) Cray T90 (gypsy)
Diffstat (limited to 'src')
-rw-r--r--src/H5detect.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/H5detect.c b/src/H5detect.c
index eb8f9ac..f0895b1 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -112,14 +112,14 @@ precision (detected_t *d)
*/
for (n=0; n<d->size && d->perm[n]<0; n++) /*void*/;
d->precision = 8*(d->size-n);
- d->offset = 8*n;
+ d->offset = 0;
} else if (d->perm[d->size - 1] < 0) {
/*
* Higher addresses are padded.
*/
for (n=0; n<d->size && d->perm[d->size-(n+1)]; n++) /*void*/;
d->precision = 8*(d->size-n);
- d->offset = 0;
+ d->offset = 8*n;
} else {
/*
* No padding.
@@ -311,7 +311,7 @@ precision (detected_t *d)
#if defined(H5_HAVE_LONGJMP) && defined(H5_HAVE_SIGNAL)
#define ALIGNMENT(TYPE,INFO) { \
char *volatile _buf=NULL; \
- volatile TYPE _val=0; \
+ volatile TYPE _val=1; \
volatile TYPE _val2; \
volatile size_t _ano=0; \
void (*_handler)(int) = signal(SIGBUS, sigbus_handler); \
@@ -322,17 +322,20 @@ precision (detected_t *d)
if (_ano<NELMTS(align_g)) { \
*((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \
_val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/ \
- /* Cray Check: This section helps detect alignment on Cray's */ \
+ /* Cray Check: This section helps detect alignment on Cray's */ \
/* vector machines (like the SV1) which mask off */ \
- /* pointer values when pointing to non-word aligned */ \
- /* locations with pointers that are supposed to be */ \
- /* word aligned. -QAK */ \
- memset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \
- memcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(INFO.precision/8)); \
- _val2 = *((TYPE*)(_buf+align_g[_ano])); \
+ /* pointer values when pointing to non-word aligned */ \
+ /* locations with pointers that are supposed to be */ \
+ /* word aligned. -QAK */ \
+ memset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \
+ if(INFO.perm[0]) /* Big-Endian */ \
+ memcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(INFO.precision/8)); \
+ else /* Little-Endian */ \
+ memcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(INFO.precision/8)); \
+ _val2 = *((TYPE*)(_buf+align_g[_ano])); \
if(_val!=_val2) \
longjmp(jbuf_g, 1); \
- /* End Cray Check */ \
+ /* End Cray Check */ \
(INFO.align)=align_g[_ano]; \
} else { \
(INFO.align)=0; \