Home | History | Annotate | Download | only in quick
      1 /*
      2  * Copyright (C) 2012 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 <stdint.h>
     18 
     19 namespace art {
     20 
     21 int CmplFloat(float a, float b) {
     22   if (a == b) {
     23     return 0;
     24   } else if (a < b) {
     25     return -1;
     26   } else if (a > b) {
     27     return 1;
     28   }
     29   return -1;
     30 }
     31 
     32 int CmpgFloat(float a, float b) {
     33   if (a == b) {
     34     return 0;
     35   } else if (a < b) {
     36     return -1;
     37   } else if (a > b) {
     38     return 1;
     39   }
     40   return 1;
     41 }
     42 
     43 int CmpgDouble(double a, double b) {
     44   if (a == b) {
     45     return 0;
     46   } else if (a < b) {
     47     return -1;
     48   } else if (a > b) {
     49     return 1;
     50   }
     51   return 1;
     52 }
     53 
     54 int CmplDouble(double a, double b) {
     55   if (a == b) {
     56     return 0;
     57   } else if (a < b) {
     58     return -1;
     59   } else if (a > b) {
     60     return 1;
     61   }
     62   return -1;
     63 }
     64 
     65 extern "C" int64_t artLmulFromCode(int64_t a, int64_t b) {
     66   return a * b;
     67 }
     68 
     69 extern "C" int64_t artLdivFromCode(int64_t a, int64_t b) {
     70   return a / b;
     71 }
     72 
     73 extern "C" int64_t artLdivmodFromCode(int64_t a, int64_t b) {
     74   return a % b;
     75 }
     76 
     77 }  // namespace art
     78