简体   繁体   English

C#UL和>>运算符

[英]C# UL and >> operators

What does this meaning mean in words? 这句话的含义是什么?

(SomeVariable * 330UL >> 10)

Is it: SomeVariable times 3.3 shift right 10 bit?? 是吗:SomeVariable倍3.3向右移10位?

No. 没有。

It means SomeVariable times 330, promote to long and shift non-cyclically right 10bits. 这意味着SomeVariable time 330,升至长并非周期性地右移10位。

(it would be cyclic, or arithmetic shift without the promotion). (这将是循环的,或者没有提升的算术移位)。

Right-shifting an integral value by one is equivalent to dividing it by 2. Two shifts equivalent to dividing by 4. Etcetera. 右移整数值等于将其除以2。两次移位等效于将值除以4。Etcetera。 Which makes the expression equivalent to: 这使得表达式等同于:

ulong value = ((ulong)SomeVariable * 330) / 1024;

UL stands for Unsigned Long. UL代表Unsigned Long。 >> yes it is bitwise arithmetic shift. >>是的,这是按位算术移位。

可变时间330作为无符号长移位右移10位

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM