将整数移位零次的效果是什么?

rad*_*dai 3 java

我刚刚在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);
}
Run Code Online (Sandbox Code Playgroud)

将int左移0的重点是什么?

ars*_*jii 5

在该类声明之前,有以下评论:

// -- This file was mechanically generated: Do not edit! -- //
Run Code Online (Sandbox Code Playgroud)

使用的代码生成方案可能没有费心去除0,即使它们没有效果.