Skip to content

Commit b6c764b

Browse files
committed
Alignment fix
1 parent 8930294 commit b6c764b

File tree

2 files changed

+89
-105
lines changed

2 files changed

+89
-105
lines changed

math/vecops/inc/ROOT/RVec.hxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ public:
143143
// and we prefer the smaller Size_T to reduce the size of each RVec object.
144144
using Size_T = int32_t;
145145

146-
void *fBeginX;
147146
protected:
147+
void *fBeginX;
148148
/// Always >= 0.
149149
// Type is signed only for consistency with fCapacity.
150150
Size_T fSize = 0;
@@ -213,7 +213,9 @@ class R__CLING_PTRCHECK(off) SmallVectorTemplateCommon : public SmallVectorBase
213213
/// SmallVectorStorage is properly-aligned even for small-size of 0.
214214
void *getFirstEl() const
215215
{
216-
return const_cast<void *>(reinterpret_cast<const void *>(reinterpret_cast<const char *>(this) +
216+
// get the SmallVectorBase subobject inside RVec
217+
auto *base = static_cast<const SmallVectorBase *>(this);
218+
return const_cast<void *>(reinterpret_cast<const void *>(reinterpret_cast<const char *>(base) +
217219
offsetof(SmallVectorAlignmentAndSize<T>, FirstEl)));
218220
}
219221
// Space after 'FirstEl' is clobbered, do not add any instance vars after it.

0 commit comments

Comments
 (0)