cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
UNIX/Linux Programming
Bitwise shift operation
Bitwise shift operation
Feb 8, 2013 at 10:23am UTC
bibhukalyana
(4)
Hi everyone,
I want to know what happened internally in bitwise shift operation.
What happened when i execute the below statement ?
value >> 10;
Is it equivalent of doing "value >> 1" 10 times ?(According to execution time)
Can i create an operator overloading for shift operator ?
Thanks.
Feb 8, 2013 at 11:53am UTC
Peter87
(11175)
The hardware can probably do
value >> 10
in the same time as
value >> 1
so doing
value >> 1
10 times will be slower unless it is able to optimize it.
You can overload the shift operator. If you haven't noticed, that is exactly what the streams do.
Topic archived. No new replies allowed.