Skip to content

Commit

Permalink
Code cleanup: Use c++ type std::uintptr_t (danmar#6681)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmar committed Aug 11, 2024
1 parent 17d2cef commit aa3b8d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions cppcheckpremium-suppressions
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ premium-misra-cpp-2023-7.11.3
# too picky about operator precedence.
premium-misra-cpp-2023-8.0.1

# TODO use std::uintptr_t
# TODO review lambda captures
premium-misra-cpp-2023-8.1.1

# TODO should we use this rule?
Expand All @@ -139,9 +139,6 @@ premium-misra-cpp-2023-8.2.6
# intentional pointer to int conversion in lib/utils.h to output dump files
premium-misra-cpp-2023-8.2.7:lib/utils.h

# TODO: use std::uintptr_t
premium-misra-cpp-2023-8.2.8

# TODO check ellipsis usage
premium-misra-cpp-2023-8.2.11

Expand Down
4 changes: 2 additions & 2 deletions lib/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static inline std::string id_string_i(std::uintptr_t l)
while (l != 0)
{
char c;
const uintptr_t temp = l % 16; // get the remainder
const std::uintptr_t temp = l % 16; // get the remainder
if (temp < 10) {
// 0-9
c = '0' + temp;
Expand All @@ -340,7 +340,7 @@ static inline std::string id_string_i(std::uintptr_t l)

static inline std::string id_string(const void* p)
{
return id_string_i(reinterpret_cast<uintptr_t>(p));
return id_string_i(reinterpret_cast<std::uintptr_t>(p));
}

static inline const char* bool_to_string(bool b)
Expand Down

0 comments on commit aa3b8d9

Please sign in to comment.