diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-12-11 18:53:22 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-12-11 18:53:22 (GMT) |
commit | 33ed41455eff31751d3d9d635140996ebbc61a4e (patch) | |
tree | a91ce9ad32cf0ea4157b3a15e8b21d2a01c274fa | |
parent | 3baaa562ee650b7c5062c747cab425cd80ab53e0 (diff) | |
download | hdf5-33ed41455eff31751d3d9d635140996ebbc61a4e.zip hdf5-33ed41455eff31751d3d9d635140996ebbc61a4e.tar.gz hdf5-33ed41455eff31751d3d9d635140996ebbc61a4e.tar.bz2 |
[svn-r4695] Purpose:
Bug Fix
Description:
The file metadata macros generate unaligned access warnings on the IA64
architecture.
Solution:
Got rid of bogus big-endian vs. little-endian differentiation when encoding
and decoding file metadata and use proper set of macros to prevent unaligned
access problems.
This fixes bug #672.
Platforms tested:
FreeBSD 4.4 (sleipnir)
-rw-r--r-- | release_docs/RELEASE.txt | 2 | ||||
-rw-r--r-- | src/H5Fprivate.h | 40 |
2 files changed, 2 insertions, 40 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 09be12f..f848fc3 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -93,6 +93,8 @@ Library * Fixed an off-by-one error in H5Sselect_valid when hyperslab selections which would allow hyperslab selections which overlapped the edge of the selection by one element as valid. + * Fixed the internal macros used to encode & decode file metadata, to avoid + an unaligned access warning on IA64 machines. Configuration ------------- diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 7aab749..cedfc38 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -31,8 +31,6 @@ typedef struct H5F_t H5F_t; * Currently, all file meta-data is little-endian. */ -/* For non-little-endian platforms, encode each byte by itself */ -#ifdef WORDS_BIGENDIAN # define INT16ENCODE(p, i) { \ *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ @@ -139,44 +137,6 @@ typedef struct H5F_t H5F_t; (p) += 8; \ } -#else - /* For little-endian platforms, make the compiler do the work */ -# define INT16ENCODE(p, i) {*((int16_t*)(p))=(int16_t)(i);(p)+=2;} -# define UINT16ENCODE(p, i) {*((uint16_t*)(p))=(uint16_t)(i);(p)+=2;} -# define INT32ENCODE(p, i) {*((int32_t*)(p))=(int32_t)(i);(p)+=4;} -# define UINT32ENCODE(p, i) {*((uint32_t*)(p))=(uint32_t)(i);(p)+=4;} - -# define INT64ENCODE(p, i) { \ - *((int64_t *)(p)) = (int64_t)(i); \ - (p) += sizeof(int64_t); \ - if (4==sizeof(int64_t)) { \ - *(p)++ = (i)<0?0xff:0x00; \ - *(p)++ = (i)<0?0xff:0x00; \ - *(p)++ = (i)<0?0xff:0x00; \ - *(p)++ = (i)<0?0xff:0x00; \ - } \ -} - -# define UINT64ENCODE(p, i) { \ - *((uint64_t *)(p)) = (uint64_t)(i); \ - (p) += sizeof(uint64_t); \ - if (4==sizeof(uint64_t)) { \ - *(p)++ = 0x00; \ - *(p)++ = 0x00; \ - *(p)++ = 0x00; \ - *(p)++ = 0x00; \ - } \ -} - -# define INT16DECODE(p, i) {(i)=(int16_t)(*(const int16_t*)(p));(p)+=2;} -# define UINT16DECODE(p, i) {(i)=(uint16_t)(*(const uint16_t*)(p));(p)+=2;} -# define INT32DECODE(p, i) {(i)=(int32_t)(*(const int32_t*)(p));(p)+=4;} -# define UINT32DECODE(p, i) {(i)=(uint32_t)(*(const uint32_t*)(p));(p)+=4;} -# define INT64DECODE(p, i) {(i)=(int64_t)(*(const int64_t*)(p));(p)+=8;} -# define UINT64DECODE(p, i) {(i)=(uint64_t)(*(const uint64_t*)(p));(p)+=8;} - -#endif - #define NBYTEENCODE(d, s, n) { HDmemcpy(d,s,n); p+=n } /* |