From f1463ef52a033c4d285ad2e9992c8ec27cdda3fe Mon Sep 17 00:00:00 2001 From: Matthew A Johnson Date: Fri, 28 May 2021 15:52:04 +0100 Subject: [PATCH] Hotfixes/int64 size (#24) * Bug fix for integer shift size * Bumping version --- CHANGELOG.md | 5 +++++ RELEASE_NOTES | 7 +------ VERSION | 2 +- src/npz.cpp | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a50415f..a124f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2021-05-28 - Version 1.4.1](https://github.com/matajoh/libnpy/releases/tag/v1.4.1) + +Bug fixes: +- Fixed a bug with integer shifting + ## [2021-05-28 - Version 1.4.0](https://github.com/matajoh/libnpy/releases/tag/v1.4.0) Improvements: diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 058736e..24f4ff0 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,7 +1,2 @@ -Improvements: -- Further minor CMake changes to improve ease of use -- NPZ streams now have `is_open` methods to check for successful file opening -- Minor code style changes - Bug fixes: -- NPZ files will now correctly handle PKZIP versions after 2.0, both for reading and writing \ No newline at end of file +- Fixed a bug with integer shifting diff --git a/VERSION b/VERSION index e21e727..13175fd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.0 \ No newline at end of file +1.4.1 \ No newline at end of file diff --git a/src/npz.cpp b/src/npz.cpp index 85a7293..e9b02d2 100644 --- a/src/npz.cpp +++ b/src/npz.cpp @@ -65,8 +65,8 @@ void write(std::ostream &stream, std::uint64_t value) std::uint16_t read16(std::istream &stream) { - std::uint8_t low = stream.get(); - std::uint8_t high = stream.get(); + std::uint16_t low = stream.get(); + std::uint16_t high = stream.get(); return low | (high << 8); } @@ -76,7 +76,7 @@ std::uint32_t read32(std::istream &stream) int shift = 0; for (int i = 0; i < 4; ++i, shift += 8) { - std::uint8_t part = stream.get(); + std::uint32_t part = stream.get(); result |= part << shift; } @@ -89,7 +89,7 @@ std::uint64_t read64(std::istream &stream) int shift = 0; for(int i=0; i<8; ++i, shift += 8) { - std::uint8_t part = stream.get(); + std::uint64_t part = stream.get(); result |= part << shift; }