簡體   English   中英

將整數移位零次的效果是什么?

[英]what is the effect of shifting an integer zero times?

我剛剛在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的重點是什么?

在該類聲明之前,有以下評論:

// -- This file was mechanically generated: Do not edit! -- //

使用的代碼生成方案可能沒有費心去除0,即使它們沒有效果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM