将int值按位移位的目的是什么? [英] What's the purpose to bit-shift int value by zero?

查看:96
本文介绍了将int值按位移位的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看java.nio.DirectByteBuffer类的源代码,我发现了这个:

Looking to the source code of java.nio.DirectByteBuffer class, I have found this:

if ((length << 0) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) ....

转移的目的是什么长度为零位?可能这是一些性能优化还是其他什么?

What is the purpose to shift length by zero bits? May this be some perfomance optimization or something else?

推荐答案

我想我已经解决了。

在class JavaDocs:

In the class JavaDocs:

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

所以它不是手工编码的。它是脚本生成的,当位移的数量为零时,脚本编写器没有为该情况添加优化。

So it is not hand coded. It was script-generated and the script writer did not add an optimisation for the case when the amount to bit shift by is zero.

这篇关于将int值按位移位的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆