Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1 | /* |
Elliott Hughes | 0f3c553 | 2012-03-30 14:51:51 -0700 | [diff] [blame] | 2 | * Copyright (C) 2012 The Android Open Source Project |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 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 | |
jeffhao | 644d531 | 2012-05-03 19:04:49 -0700 | [diff] [blame] | 65 | extern "C" int64_t artLmulFromCode(int64_t a, int64_t b) { |
Elliott Hughes | 65c6cf3 | 2012-04-16 20:44:17 -0700 | [diff] [blame] | 66 | return a * b; |
| 67 | } |
| 68 | |
Ian Rogers | 55bd45f | 2012-04-04 17:31:20 -0700 | [diff] [blame] | 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 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 77 | } // namespace art |