Equivalent of Java triple shift operator (>>>) in C#?

前端 未结 6 2091
轻奢々
轻奢々 2020-12-15 17:10

What is the equivalent (in C#) of Java\'s >>> operator?

(Just to clarify, I\'m not referring to the >> and <<

6条回答
  •  感情败类
    2020-12-15 17:38

    Java doesn't have an unsigned left shift (<<<), but either way, you can just cast to uint and shfit from there.

    E.g.

    (int)((uint)foo >> 2); // temporarily cast to uint, shift, then cast back to int
    

提交回复
热议问题