Reputation: 1628
What does this meaning mean in words?
(SomeVariable * 330UL >> 10)
Is it: SomeVariable times 3.3 shift right 10 bit??
Upvotes: 1
Views: 397
Reputation: 941635
Right-shifting an integral value by one is equivalent to dividing it by 2. Two shifts equivalent to dividing by 4. Etcetera. Which makes the expression equivalent to:
ulong value = ((ulong)SomeVariable * 330) / 1024;
Upvotes: 2
Reputation: 60065
UL stands for Unsigned Long. >> yes it is bitwise arithmetic shift.
Upvotes: 1
Reputation: 19114
No.
It means SomeVariable times 330, promote to long and shift non-cyclically right 10bits.
(it would be cyclic, or arithmetic shift without the promotion).
Upvotes: 5