Shifts can be combined with the equal sign (<<= or >>= or >>>=). The lvalue is replaced by
the lvalue shifted by the rvalue. There is a problem, however, with the unsigned right shift
combined with assignment. If you use it with byte or short, you don’t get the correct results.
Instead, these are promoted to int and right shifted, but then truncated as they are assigned
back into their variables, so you get -1 in those cases. The following example demonstrates
this:
红色部分怎么理解?谢谢
------解决方案--------------------
运算的时候提升为int,运算结束赋值的时候又把高位截掉了.
------解决方案--------------------
高位是 左边.. 右边是低位.