Skip to content

Commit

Permalink
HPCC-32826 Avoid integer underflow when calculating elapsed cycles
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Oct 18, 2024
1 parent 6131e81 commit 76ae51a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion system/include/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ typedef unsigned __int64 hash64_t;
typedef unsigned __int64 __uint64;
typedef __uint64 offset_t;
typedef unsigned char byte;
typedef __int64 cycle_t;
typedef __uint64 cycle_t; // This must be unsigned to avoid integer overflow issues when subtracting
typedef unsigned __int64 timestamp_type;

// BUILD_TAG not needed here anymore - defined in build_tag.h
Expand Down
4 changes: 2 additions & 2 deletions system/jlib/jdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ class TimeSectionInfo : public MappingBase
unsigned getCount() const { return count; }

StringAttr scope;
__int64 totalcycles;
__int64 maxcycles;
cycle_t totalcycles;
cycle_t maxcycles;
unsigned count;
};

Expand Down

0 comments on commit 76ae51a

Please sign in to comment.