当前位置:网站首页>Why is this an undefined behavior- Why is this an undefined behavior?
Why is this an undefined behavior- Why is this an undefined behavior?
2022-07-05 02:36:00 【Bustling city 】
problem :
My answer to this question was this function: I am right. The answer to this question It's this function :
inline bool divisible15(unsigned int x) { //286331153 = (2^32 - 1) / 15 //4008636143 = (2^32) - 286331153 return x * 4008636143 <= 286331153;}It perfectly worked on my machine with VS2008 compiler, however here it doesn't work at all. It is completely applicable to my machine and VS2008 compiler , but ad locum It doesn't work at all .
Does anyone has an idea, why it I get different results on different compilers? Does anyone have an idea , Why do I get different results on different compilers ?unsigned overflow isn't undefined behavior.unsigned Overflow is not an undefined behavior .
Important note: after some test it was confirmed it is faster than taking the remainder of the division by 15. (However not on all compilers) Important note : After some testing , Make sure it's better than dividing the remainder of the division by 15 faster .( But not on all compilers )
Solution :
Reference resources : https://stackoom.com/en/question/1GUVX边栏推荐
- 官宣!第三届云原生编程挑战赛正式启动!
- GFS分布式文件系统
- 打破信息茧房-我主动获取信息的方法 -#3
- [機緣參悟-38]:鬼穀子-第五飛箝篇 - 警示之一:有一種殺稱為“捧殺”
- [download white paper] does your customer relationship management (CRM) really "manage" customers?
- 2022/02/13
- 低度酒赛道进入洗牌期,新品牌如何破局三大难题?
- Pytorch register_ Hook (operate on gradient grad)
- February database ranking: how long can Oracle remain the first?
- ELFK部署
猜你喜欢
![Hmi-32- [motion mode] add light panel and basic information column](/img/9c/0b25c0a41758652848aed2a269880f.jpg)
Hmi-32- [motion mode] add light panel and basic information column

Summary and practice of knowledge map construction technology

Binary tree traversal - middle order traversal (golang)

【LeetCode】404. Sum of left leaves (2 brushes of wrong questions)

Day_ 17 IO stream file class

"C zero foundation introduction hundred knowledge and hundred cases" (72) multi wave entrustment -- Mom shouted for dinner

The MySQL team development specifications used by various factories are too detailed. It is recommended to collect them!

JVM - when multiple threads initialize the same class, only one thread is allowed to initialize

Open source SPL optimized report application coping endlessly

He was laid off.. 39 year old Ali P9, saved 150million
随机推荐
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
[技术发展-26]:新型信息与通信网络的数据安全
如何做一个炫酷的墨水屏电子钟?
Which common ports should the server open
Leetcode takes out the least number of magic beans
Serious bugs with lifted/nullable conversions from int, allowing conversion from decimal
【LeetCode】110. Balanced binary tree (2 brushes of wrong questions)
GFS distributed file system
Prometheus monitors the correct posture of redis cluster
d3js小记
Medusa installation and simple use
Using druid to connect to MySQL database reports the wrong type
Icu4c 70 source code download and compilation (win10, vs2022)
Zabbix
数据库和充值都没有了
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
ELFK部署
Tucson will lose more than $400million in the next year
. Net starts again happy 20th birthday
ELK日志分析系统