diff options
Diffstat (limited to 'src/H5HGprivate.h')
-rw-r--r-- | src/H5HGprivate.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 6b64e8d..c4e0f1f 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -32,6 +32,7 @@ #define H5HG_ALIGNMENT 8 #define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ H5HG_ALIGNMENT)) +#define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) /* * All global heap collections are at least this big. This allows us to read @@ -53,20 +54,24 @@ #define H5HG_MAXLINK 65535 /* - * The size of the collection header. + * The size of the collection header, always a multiple of the alignment so + * that the stuff that follows the header is aligned. */ -#define H5HG_SIZEOF_HDR(f) (4 + /*magic number */ \ - 1 + /*version number */ \ - 3 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*collection size */ +#define H5HG_SIZEOF_HDR(f) \ + H5HG_ALIGN(4 + /*magic number */ \ + 1 + /*version number */ \ + 3 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*collection size */ /* - * The overhead associated with each object in the heap. + * The overhead associated with each object in the heap, always a multiple of + * the alignment so that the stuff that follows the header is aligned. */ -#define H5HG_SIZEOF_OBJHDR(f) (2 + /*object id number */ \ - 2 + /*reference count */ \ - 4 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*object data size */ +#define H5HG_SIZEOF_OBJHDR(f) \ + H5HG_ALIGN(2 + /*object id number */ \ + 2 + /*reference count */ \ + 4 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*object data size */ /* * The initial guess for the number of messages in a collection. We assume |