我刚在DirectByteBuffer.slice()发现了这一点:
public ByteBuffer slice() {
int pos = this.position();
int lim = this.limit();
assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0);
int off = (pos << 0); // <---- what does this do
assert (off >= 0);
return new DirectByteBuffer(this, -1, 0, rem, rem, off);
}
将int左移0的重点是什么?
答案 0 :(得分:5)
在该课程的宣言之前,有以下评论:
// -- This file was mechanically generated: Do not edit! -- //
使用的代码生成方案可能并不打算将移位除去0,即使它们没有效果。