警告:左移计数> =类型的宽度[-wshift-count-overflow]

发布于 2025-01-24 00:01:55 字数 125 浏览 2 评论 0原文

我有这个问题吗? 警告:左移计数> =类型的宽度[-wshift-count-overflow] *sensor_time =(uint32_t)(((msb<< 16)|(xlsb<< 8)| lsb);

i got this problem?
warning: left shift count >= width of type [-Wshift-count-overflow]
*sensor_time = (uint32_t)((msb << 16) | (xlsb << 8) | lsb);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左岸枫 2025-01-31 00:01:55

长期可能是32位或64位类型,具体取决于您的系统,1仍然是INT。您需要使用l后缀使1个长int,如下所示:

在下面尝试代码

unsigned long x = 1UL << 32;

unsigned long long x = 1ULL << 32

long may be a 32-bit or 64-bit type depending on your system, 1 is still an int. You need to make 1 a long int using the L suffix as shown below:

try code below

unsigned long x = 1UL << 32;

or

unsigned long long x = 1ULL << 32
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文