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 | |
Ian Rogers | 647b1a8 | 2014-10-10 11:02:11 -0700 | [diff] [blame] | 21 | #pragma clang diagnostic push |
| 22 | #pragma clang diagnostic ignored "-Wfloat-equal" |
Ian Rogers | 647b1a8 | 2014-10-10 11:02:11 -0700 | [diff] [blame] | 23 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 24 | int CmplFloat(float a, float b) { |
| 25 | if (a == b) { |
| 26 | return 0; |
| 27 | } else if (a < b) { |
| 28 | return -1; |
| 29 | } else if (a > b) { |
| 30 | return 1; |
| 31 | } |
| 32 | return -1; |
| 33 | } |
| 34 | |
| 35 | int CmpgFloat(float a, float b) { |
| 36 | if (a == b) { |
| 37 | return 0; |
| 38 | } else if (a < b) { |
| 39 | return -1; |
| 40 | } else if (a > b) { |
| 41 | return 1; |
| 42 | } |
| 43 | return 1; |
| 44 | } |
| 45 | |
| 46 | int CmpgDouble(double a, double b) { |
| 47 | if (a == b) { |
| 48 | return 0; |
| 49 | } else if (a < b) { |
| 50 | return -1; |
| 51 | } else if (a > b) { |
| 52 | return 1; |
| 53 | } |
| 54 | return 1; |
| 55 | } |
| 56 | |
| 57 | int CmplDouble(double a, double b) { |
| 58 | if (a == b) { |
| 59 | return 0; |
| 60 | } else if (a < b) { |
| 61 | return -1; |
| 62 | } else if (a > b) { |
| 63 | return 1; |
| 64 | } |
| 65 | return -1; |
| 66 | } |
| 67 | |
Ian Rogers | 647b1a8 | 2014-10-10 11:02:11 -0700 | [diff] [blame] | 68 | #pragma clang diagnostic pop |
Ian Rogers | 647b1a8 | 2014-10-10 11:02:11 -0700 | [diff] [blame] | 69 | |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 70 | extern "C" int64_t artLmul(int64_t a, int64_t b) { |
Elliott Hughes | 65c6cf3 | 2012-04-16 20:44:17 -0700 | [diff] [blame] | 71 | return a * b; |
| 72 | } |
| 73 | |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 74 | extern "C" int64_t artLdiv(int64_t a, int64_t b) { |
Ian Rogers | 55bd45f | 2012-04-04 17:31:20 -0700 | [diff] [blame] | 75 | return a / b; |
| 76 | } |
| 77 | |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 78 | extern "C" int64_t artLmod(int64_t a, int64_t b) { |
Ian Rogers | 55bd45f | 2012-04-04 17:31:20 -0700 | [diff] [blame] | 79 | return a % b; |
| 80 | } |
| 81 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 82 | } // namespace art |