1/*
2 * Copyright (C) 2010 Google Inc.
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
17package benchmarks.regression;
18
19public class IntConstantRemainderBenchmark {
20    public int timeRemainderIntByConstant2(int reps) {
21        int result = 1;
22        for (int i = 0; i < reps; ++i) {
23            result %= 2;
24        }
25        return result;
26    }
27    public int timeRemainderIntByConstant8(int reps) {
28        int result = 1;
29        for (int i = 0; i < reps; ++i) {
30            result %= 8;
31        }
32        return result;
33    }
34/*
35    public int timeRemainderIntByConstant10(int reps) {
36        int result = 1;
37        for (int i = 0; i < reps; ++i) {
38            result %= 10;
39        }
40        return result;
41    }
42    public int timeRemainderIntByConstant100(int reps) {
43        int result = 1;
44        for (int i = 0; i < reps; ++i) {
45            result %= 100;
46        }
47        return result;
48    }
49*/
50    public int timeRemainderIntByConstant2048(int reps) {
51        int result = 1;
52        for (int i = 0; i < reps; ++i) {
53            result %= 2048;
54        }
55        return result;
56    }
57    public int timeRemainderIntByVariable2(int reps) {
58        int result = 1;
59        int factor = 2;
60        for (int i = 0; i < reps; ++i) {
61            result %= factor;
62        }
63        return result;
64    }
65/*
66    public int timeRemainderIntByVariable10(int reps) {
67        int result = 1;
68        int factor = 10;
69        for (int i = 0; i < reps; ++i) {
70            result %= factor;
71        }
72        return result;
73    }
74*/
75}
76