当前位置:网站首页>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边栏推荐
- The MySQL team development specifications used by various factories are too detailed. It is recommended to collect them!
- Some query constructors in laravel (2)
- Video display and hiding of imitation tudou.com
- JVM's responsibility - load and run bytecode
- Erreur de type de datagramme MySQL en utilisant Druid
- [download white paper] does your customer relationship management (CRM) really "manage" customers?
- Go RPC call
- How to find hot projects in 2022? Dena community project progress follow-up, there is always a dish for you (1)
- Grub 2.12 will be released this year to continue to improve boot security
- JVM - when multiple threads initialize the same class, only one thread is allowed to initialize
猜你喜欢
Bert fine tuning skills experiment
Go RPC call
Practical case of SQL optimization: speed up your database
ELK日志分析系统
Variables in postman
Character painting, I use characters to draw a Bing Dwen Dwen
He was laid off.. 39 year old Ali P9, saved 150million
Learn game model 3D characters, come out to find a job?
JVM - when multiple threads initialize the same class, only one thread is allowed to initialize
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
随机推荐
【LeetCode】98. Verify the binary search tree (2 brushes of wrong questions)
The database and recharge are gone
如何做一个炫酷的墨水屏电子钟?
Introduce reflow & repaint, and how to optimize it?
Avoid material "minefields"! Play with super high conversion rate
GFS distributed file system
8. Commodity management - commodity classification
JVM - when multiple threads initialize the same class, only one thread is allowed to initialize
Single line function*
JVM's responsibility - load and run bytecode
Yolov5 model training and detection
Start the remedial work. Print the contents of the array using the pointer
【LeetCode】222. The number of nodes of a complete binary tree (2 mistakes)
Open source SPL optimized report application coping endlessly
d3js小记
openresty ngx_lua執行階段
2022/02/13
Day_ 17 IO stream file class
丸子百度小程序详细配置教程,审核通过。
【微服务|SCG】Filters的33种用法