📄 double.c
字号:
/* * @(#)Double.c 1.22 06/10/10 * * Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */#include "jni.h"#include "jni_util.h"#include "jlong.h"#include "jvm.h"#include "java_lang_Double.h"/* * Find the double float corresponding to a given bit pattern */JNIEXPORT jdouble JNICALLJava_java_lang_Double_longBitsToDouble(JNIEnv *env, jclass unused, jlong v){ union { jlong l; double d; } u; jlong_to_jdouble_bits(&v); u.l = v; return (jdouble)u.d;}/* * Find the bit pattern corresponding to a given double float, collapsing NaNs */JNIEXPORT jlong JNICALLJava_java_lang_Double_doubleToLongBits(JNIEnv *env, jclass unused, jdouble v){ union { jlong l; double d; } u; if (JVM_IsNaN((double)v)) { u.l = jint_to_jlong(0x7ff80000); return jlong_shl(u.l, 32); } jdouble_to_jlong_bits(&v); u.d = (double)v; return u.l;}/* * Find the bit pattern corresponding to a given double float, NOT collapsing NaNs */JNIEXPORT jlong JNICALLJava_java_lang_Double_doubleToRawLongBits(JNIEnv *env, jclass unused, jdouble v){ union { jlong l; double d; } u; jdouble_to_jlong_bits(&v); u.d = (double)v; return u.l;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -