blob: 0bfe59dc2f960cbf7746a1918949ade1a2aadf42 [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
21int 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
32int 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
43int 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
54int 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
jeffhao644d5312012-05-03 19:04:49 -070065extern "C" int64_t artLmulFromCode(int64_t a, int64_t b) {
Elliott Hughes65c6cf32012-04-16 20:44:17 -070066 return a * b;
67}
68
Ian Rogers55bd45f2012-04-04 17:31:20 -070069extern "C" int64_t artLdivFromCode(int64_t a, int64_t b) {
70 return a / b;
71}
72
73extern "C" int64_t artLdivmodFromCode(int64_t a, int64_t b) {
74 return a % b;
75}
76
Ian Rogers57b86d42012-03-27 16:05:41 -070077} // namespace art