1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "Dalvik.h" 18 #include "native/InternalNativePriv.h" 19 20 static void Math_absD(const u4* args, JValue* pResult) 21 { 22 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_double); 23 } 24 25 static void Math_absF(const u4* args, JValue* pResult) 26 { 27 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_float); 28 } 29 30 static void Math_absI(const u4* args, JValue* pResult) 31 { 32 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_int); 33 } 34 35 static void Math_absJ(const u4* args, JValue* pResult) 36 { 37 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_abs_long); 38 } 39 40 static void Math_cos(const u4* args, JValue* pResult) 41 { 42 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_cos); 43 } 44 45 static void Math_maxI(const u4* args, JValue* pResult) 46 { 47 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_max_int); 48 } 49 50 static void Math_minI(const u4* args, JValue* pResult) 51 { 52 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_min_int); 53 } 54 55 static void Math_sin(const u4* args, JValue* pResult) 56 { 57 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_sin); 58 } 59 60 static void Math_sqrt(const u4* args, JValue* pResult) 61 { 62 MAKE_INTRINSIC_TRAMPOLINE(javaLangMath_sqrt); 63 } 64 65 const DalvikNativeMethod dvm_java_lang_Math[] = { 66 { "abs", "(D)D", Math_absD }, 67 { "abs", "(F)F", Math_absF }, 68 { "abs", "(I)I", Math_absI }, 69 { "abs", "(J)J", Math_absJ }, 70 { "cos", "(D)D", Math_cos }, 71 { "max", "(II)I", Math_maxI }, 72 { "min", "(II)I", Math_minI }, 73 { "sin", "(D)D", Math_sin }, 74 { "sqrt", "(D)D", Math_sqrt }, 75 { NULL, NULL, NULL }, 76 }; 77