Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation error regarding undeclared uint64_t #1997

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jougs
Copy link

@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