Skip to content

Commit

Permalink
Merge pull request #2899 from eisenhauer/MultiVarFix
Browse files Browse the repository at this point in the history
Fix issue with BP5 Deserializer
  • Loading branch information
eisenhauer authored Oct 12, 2021
2 parents a3a1916 + 3f3362a commit 1c1c0b7
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 190 deletions.
10 changes: 3 additions & 7 deletions source/adios2/toolkit/format/bp5/BP5Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace adios2
namespace format
{

void BP5Base::FFSBitfieldSet(struct FFSMetadataInfoStruct *MBase, int Bit)
void BP5Base::BP5BitfieldSet(struct BP5MetadataInfoStruct *MBase, int Bit)
{
size_t Element = Bit / (sizeof(size_t) * 8);
int ElementBit = Bit % (sizeof(size_t) * 8);
Expand All @@ -38,17 +38,13 @@ void BP5Base::FFSBitfieldSet(struct FFSMetadataInfoStruct *MBase, int Bit)
MBase->BitField[Element] |= ((size_t)1 << ElementBit);
}

int BP5Base::FFSBitfieldTest(struct FFSMetadataInfoStruct *MBase, int Bit)
int BP5Base::BP5BitfieldTest(struct BP5MetadataInfoStruct *MBase, int Bit)
{
size_t Element = Bit / (sizeof(size_t) * 8);
int ElementBit = Bit % (sizeof(size_t) * 8);
if (static_cast<size_t>(Element) >= MBase->BitFieldCount)
{
MBase->BitField =
(size_t *)realloc(MBase->BitField, sizeof(size_t) * (Element + 1));
memset(MBase->BitField + MBase->BitFieldCount, 0,
(Element - MBase->BitFieldCount + 1) * sizeof(size_t));
MBase->BitFieldCount = Element + 1;
return 0;
}
return ((MBase->BitField[Element] & ((size_t)1 << ElementBit)) ==
((size_t)1 << ElementBit));
Expand Down
6 changes: 3 additions & 3 deletions source/adios2/toolkit/format/bp5/BP5Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ class BP5Base
size_t *DataLocation; // Per-block Offsets [BlockCount]
} MetaArrayRec;

struct FFSMetadataInfoStruct
struct BP5MetadataInfoStruct
{
size_t BitFieldCount;
size_t *BitField;
size_t DataBlockSize;
};

void FFSBitfieldSet(struct FFSMetadataInfoStruct *MBase, int Bit);
int FFSBitfieldTest(struct FFSMetadataInfoStruct *MBase, int Bit);
void BP5BitfieldSet(struct BP5MetadataInfoStruct *MBase, int Bit);
int BP5BitfieldTest(struct BP5MetadataInfoStruct *MBase, int Bit);
};
} // end namespace format
} // end namespace adios2
Expand Down
Loading

0 comments on commit 1c1c0b7

Please sign in to comment.