Skip to content

Fix compilation error regarding undeclared uint64_t#1997

Open
jougs wants to merge 2 commits intoTencent:masterfrom
jougs:patch-1
Open

Fix compilation error regarding undeclared uint64_t#1997
jougs wants to merge 2 commits intoTencent:masterfrom
jougs:patch-1

Conversation

@jougs
Copy link
Copy Markdown

@jougs jougs commented Mar 10, 2025

With GCC 14.2.0, I get the following error message when compiling with default configuration:

source/tnn/utils/data_type_utils.cc: In static member function ‘static int tnn::DataTypeUtils::SaturateCast(long long int)’:
source/tnn/utils/data_type_utils.cc:61:19: error: ‘uint64_t’ was not declared in this scope
   61 |     return (int)((uint64_t)(data - INT_MIN) <= (uint64_t)UINT_MAX ? data : data > 0 ? INT_MAX : INT_MIN);
      |                   ^~~~~~~~
source/tnn/utils/data_type_utils.cc:17:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
   16 | #include <limits.h>
  +++ |+#include <cstdint>
   17 | #include "tnn/core/macro.h"

The change suggested by the compiler indeed fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant