Skip to content

Commit

Permalink
work around MSVC misoptimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ahigerd committed Sep 1, 2023
1 parent cc9b9cf commit 25f8077
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ template <typename T, typename Container>
T parseInt(const Container& buffer, size_t offset)
{
uint64_t result = 0;
for (ssize_t i = sizeof(T) - 1; i >= 0; --i) {
for (ssize_t i = sizeof(T) - 1; i >= 0 && i < sizeof(T); --i) {
result = (result << 8) | uint8_t(buffer[offset + i]);
}
return T(result);
Expand Down

0 comments on commit 25f8077

Please sign in to comment.