gpt4 book ai didi

jvm - Java java.lang.Integer类中的代码注释 'HD, Figure'是什么意思?

转载 作者:行者123 更新时间:2023-11-30 06:05:23 27 4
gpt4 key购买 nike

例如JDK方法java.lang.Integer.numberOfLeadingZeros(int):

public static int numberOfLeadingZeros(int i) {
// HD, Figure 5-6
if (i == 0)
return 32;
int n = 1;
if (i >>> 16 == 0) { n += 16; i <<= 16; }
if (i >>> 24 == 0) { n += 8; i <<= 8; }
if (i >>> 28 == 0) { n += 4; i <<= 4; }
if (i >>> 30 == 0) { n += 2; i <<= 2; }
n -= i >>> 31;
return n;
}

代码注释“HD, Figure 5-6”是什么意思?

最佳答案

HD = 黑客的喜悦。查看the javadoc :

Implementation note: The implementations of the "bit twiddling" methods (such as highestOneBit and numberOfTrailingZeros) are based on material from Henry S. Warren, Jr.'s Hacker's Delight, (Addison Wesley, 2002).

关于jvm - Java java.lang.Integer类中的代码注释 'HD, Figure'是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46710028/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com