blob: 1c658b70575be3aba93034d2b6dc9d700cd95a85 [file] [log] [blame]
Ian Rogers57b86d42012-03-27 16:05:41 -07001/*
Elliott Hughes0f3c5532012-03-30 14:51:51 -07002 * Copyright (C) 2012 The Android Open Source Project
Ian Rogers57b86d42012-03-27 16:05:41 -07003 *
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
19namespace art {
20
Ian Rogers647b1a82014-10-10 11:02:11 -070021#if defined(__clang__)
22#pragma clang diagnostic push
23#pragma clang diagnostic ignored "-Wfloat-equal"
24#endif
25
Ian Rogers57b86d42012-03-27 16:05:41 -070026int CmplFloat(float a, float b) {
27 if (a == b) {
28 return 0;
29 } else if (a < b) {
30 return -1;
31 } else if (a > b) {
32 return 1;
33 }
34 return -1;
35}
36
37int CmpgFloat(float a, float b) {
38 if (a == b) {
39 return 0;
40 } else if (a < b) {
41 return -1;
42 } else if (a > b) {
43 return 1;
44 }
45 return 1;
46}
47
48int CmpgDouble(double a, double b) {
49 if (a == b) {
50 return 0;
51 } else if (a < b) {
52 return -1;
53 } else if (a > b) {
54 return 1;
55 }
56 return 1;
57}
58
59int CmplDouble(double a, double b) {
60 if (a == b) {
61 return 0;
62 } else if (a < b) {
63 return -1;
64 } else if (a > b) {
65 return 1;
66 }
67 return -1;
68}
69
Ian Rogers647b1a82014-10-10 11:02:11 -070070#if defined(__clang__)
71#pragma clang diagnostic pop
72#endif
73
Ian Rogersa9a82542013-10-04 11:17:26 -070074extern "C" int64_t artLmul(int64_t a, int64_t b) {
Elliott Hughes65c6cf32012-04-16 20:44:17 -070075 return a * b;
76}
77
Ian Rogersa9a82542013-10-04 11:17:26 -070078extern "C" int64_t artLdiv(int64_t a, int64_t b) {
Ian Rogers55bd45f2012-04-04 17:31:20 -070079 return a / b;
80}
81
Ian Rogersa9a82542013-10-04 11:17:26 -070082extern "C" int64_t artLmod(int64_t a, int64_t b) {
Ian Rogers55bd45f2012-04-04 17:31:20 -070083 return a % b;
84}
85
Ian Rogers57b86d42012-03-27 16:05:41 -070086} // namespace art