Skip to content

Commit

Permalink
Change size_t to uint64_t for storing sub-block-minmax info and fix u…
Browse files Browse the repository at this point in the history
…pdate function to read 8 bytes instead of 4.
  • Loading branch information
pnorbert committed Oct 7, 2020
1 parent 9ea6100 commit ce36fa3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion source/adios2/toolkit/format/bp/BPBase.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ inline void BPBase::ParseCharacteristics(const std::vector<char> &buffer,
helper::ReadValue<uint8_t>(buffer, position,
isLittleEndian));
characteristics.Statistics.SubBlockInfo.SubBlockSize =
helper::ReadValue<size_t>(buffer, position, isLittleEndian);
static_cast<size_t>(helper::ReadValue<uint64_t>(
buffer, position, isLittleEndian));

characteristics.Statistics.SubBlockInfo.Div.resize(
dimensionsSize);
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/format/bp/BPSerializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void BPSerializer::UpdateIndexOffsetsCharacteristics(size_t &currentPosition,
currentPosition += 2 * sizeof(T); // block min/max
if (M > 1)
{
currentPosition += 1 + 4; // method, blockSize
currentPosition += 1 + 8; // method (byte), blockSize (uint64_t)
currentPosition +=
dimensionsSize * sizeof(uint16_t); // N-dim division
currentPosition += 2 * M * sizeof(T); // M * min/max
Expand Down
10 changes: 6 additions & 4 deletions source/adios2/toolkit/format/bp/bp4/BP4Serializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,9 @@ void BP4Serializer::PutBoundsRecord(const bool singleValue,
uint8_t method =
static_cast<uint8_t>(stats.SubBlockInfo.DivisionMethod);
helper::InsertToBuffer(buffer, &method);
helper::InsertToBuffer(buffer,
&stats.SubBlockInfo.SubBlockSize);
uint64_t subBlockSize =
static_cast<uint64_t>(stats.SubBlockInfo.SubBlockSize);
helper::InsertToBuffer(buffer, &subBlockSize);

const uint16_t N =
static_cast<uint16_t>(stats.SubBlockInfo.Div.size());
Expand Down Expand Up @@ -673,8 +674,9 @@ void BP4Serializer::PutBoundsRecord(const bool singleValue,
uint8_t method =
static_cast<uint8_t>(stats.SubBlockInfo.DivisionMethod);
helper::CopyToBuffer(buffer, position, &method);
helper::CopyToBuffer(buffer, position,
&stats.SubBlockInfo.SubBlockSize);
uint64_t subBlockSize =
static_cast<uint64_t>(stats.SubBlockInfo.SubBlockSize);
helper::CopyToBuffer(buffer, position, &subBlockSize);

const uint16_t N =
static_cast<uint16_t>(stats.SubBlockInfo.Div.size());
Expand Down

0 comments on commit ce36fa3

Please sign in to comment.