cal*_*pto 2 c++ math boolean-operations
|之间有什么重大区别吗?和+会影响代码的长期性能?或者都是O(1)?我正在使用的代码是这样的:
uint64_t dostuff(uint64_t a,uint64_t b){
// the max values of the inputs are 2^32 - 1
// lots of stuff involving boolean operators
// that have no way of being substituted by
// arithmetic operators
return (a << 32) + b;
//or
return (a << 32) | b;
}
Run Code Online (Sandbox Code Playgroud)
代码将被多次使用,所以我想尽可能加快速度.
| 归档时间: |
|
| 查看次数: |
185 次 |
| 最近记录: |