blob: e69f64bfc22dc4a142144353522dc6ba8a710f08 [file] [log] [blame]
Nicolas Geoffray486cc192014-12-08 18:00:55 +00001/*
2 * Copyright (C) 2014 The Android Open Source Project
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
17public class Main {
18 public static void main(String[] args) {
19 assertEquals(0x80000000, doShiftInt(1));
20 assertEquals(0x8000000000000000L, doShiftLong(1L));
21 }
22
23 public static int doShiftInt(int value) {
24 return value << 0xFFFF;
25 }
26
27 public static long doShiftLong(long value) {
28 return value << 0xFFFF;
29 }
30
31 public static void assertEquals(int a, int b) {
32 if (a != b) {
33 throw new Error("Expected " + a + ", got " + b);
34 }
35 }
36
37 public static void assertEquals(long a, long b) {
38 if (a != b) {
39 throw new Error("Expected " + a + ", got " + b);
40 }
41 }
42}