summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2022-04-19 17:20:12 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2022-04-19 17:20:12 (GMT)
commitcbaeb279ae62a24856e0e77c552c0767ef44de68 (patch)
tree3707128c2abc011746695c39797d43d538abc9ee
parentbe65814cde13ed88f670fc9052067d5b3d621a02 (diff)
downloadhdf5-cbaeb279ae62a24856e0e77c552c0767ef44de68.zip
hdf5-cbaeb279ae62a24856e0e77c552c0767ef44de68.tar.gz
hdf5-cbaeb279ae62a24856e0e77c552c0767ef44de68.tar.bz2
Extract struct-offset arithmetic into macro TAG_ALIGNMENT for reuse in a
later commit.
-rw-r--r--src/H5Tnative.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 85da7ce..8c94be4 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -941,11 +941,13 @@ H5T__cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size, size_t nele
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T__cmp_offset() */
+#define TAG_ALIGNMENT(tag) \
+ (offsetof(alignments_t, tag.x) - offsetof(alignments_t, tag))
+
/* clang-format off */
#define NATIVE_ENTRY_INITIALIZER(tag, type, precision, has_sign) { \
.alignmentp = &H5T_NATIVE_##tag##_ALIGN_g \
-, .alignment = offsetof(alignments_t, tag.x) - \
- offsetof(alignments_t, tag) \
+, .alignment = TAG_ALIGNMENT(tag) \
, .hidp = &H5T_NATIVE_##tag##_g \
, .size = sizeof(type) \
, .atomic = { \