当前位置: 技术问答>java相关
谁有Java源代码中floatToIntBits,intBitsToFloat的源代码?
来源: 互联网 发布时间:2015-04-12
本文导语: 还有,doubleToLongBits longBitsToDouble? 这些遵循IEEE754规范。 但是,我无法从Jb中找到他们的source code | In java they are all native method So you can't find source code. Because native methods are implemented in platform d...
还有,doubleToLongBits
longBitsToDouble?
这些遵循IEEE754规范。
但是,我无法从Jb中找到他们的source code
longBitsToDouble?
这些遵循IEEE754规范。
但是,我无法从Jb中找到他们的source code
|
In java they are all native method
So you can't find source code.
Because native methods are implemented in platform depedent way,
e.g. *.dll in windows
So you can't find source code.
Because native methods are implemented in platform depedent way,
e.g. *.dll in windows
|
/*
* Find the bit pattern corresponding to a given float, collapsing NaNs
*/
JNIEXPORT jint JNICALL
Java_java_lang_Float_floatToIntBits(JNIEnv *env, jclass unused, jfloat v)
{
union {
int i;
float f;
} u;
if (JVM_IsNaN((float)v)) {
return 0x7fc00000;
}
u.f = (float)v;
return (jint)u.i;
}
这是什么?
* Find the bit pattern corresponding to a given float, collapsing NaNs
*/
JNIEXPORT jint JNICALL
Java_java_lang_Float_floatToIntBits(JNIEnv *env, jclass unused, jfloat v)
{
union {
int i;
float f;
} u;
if (JVM_IsNaN((float)v)) {
return 0x7fc00000;
}
u.f = (float)v;
return (jint)u.i;
}
这是什么?
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。