Hi!
What does this meaning mean in words?
(SomeVariable * 330UL >> 10)
Is it: SomeVariable times 3.3 shift right 10 bit??
Kind regards!
Hi!
What does this meaning mean in words?
(SomeVariable * 330UL >> 10)
Is it: SomeVariable times 3.3 shift right 10 bit??
Kind regards!
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).
UL stands for Unsigned Long. >> yes it is bitwise arithmetic shift.
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;