Potentially depends on the CPU.
However, all modern CPUs (x86, ARM) use a “barrel shifter” — a hardware module specifically designed to perform arbitrary shifts in constant time.
So the bottom line is… no. No difference.
More Related Contents:
- How can I measure CPU time and wall clock time on both Linux/Windows?
- Is there a performance difference between i++ and ++i in C++?
- Why does changing 0.1f to 0 slow down performance by 10x?
- How to “return an object” in C++?
- Why are elementwise additions much faster in separate loops than in a combined loop?
- Is std::vector so much slower than plain arrays?
- Why is transposing a matrix of 512×512 much slower than transposing a matrix of 513×513?
- How to write a large buffer into a binary file in C++, fast?
- Is it better to use std::memcpy() or std::copy() in terms to performance?
- Fast textfile reading in c++
- Which is faster: Stack allocation or Heap allocation
- C++ : Catch a divide by zero error
- What’s your favorite profiling tool (for C++) [closed]
- How much is the overhead of smart pointers compared to normal pointers in C++?
- Using AVX CPU instructions: Poor performance without “/arch:AVX”
- Why does this delay-loop start to run faster after several iterations with no sleep?
- Fast Cross-Platform C/C++ Image Processing Libraries
- What is the fastest way to change a key of an element inside std::map
- Why is std::fill(0) slower than std::fill(1)?
- Efficiency of the STL priority_queue
- Finding out the CPU clock frequency (per core, per processor)
- Avoiding denormal values in C++
- What’s the fastest way to pack 32 0/1 values into the bits of a single 32-bit variable?
- Is Python faster and lighter than C++? [closed]
- Should I still return const objects in C++11? [duplicate]
- Speed difference between If-Else and Ternary operator in C…?
- Performance penalty for working with interfaces in C++?
- Memory-efficient C++ strings (interning, ropes, copy-on-write, etc) [closed]
- Fastest way to get the integer part of sqrt(n)?
- Why is this SIMD multiplication not faster than non-SIMD multiplication?