1 /* 2 * Copyright (C) 2019 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 17 package android.aidl.tests; 18 19 @Backing(type="int") 20 enum ConstantExpressionEnum { 21 // Should be all true / ones. 22 // dec literals are either int or long 23 decInt32_1 = (~(-1)) == 0, 24 decInt32_2 = -(1 << 31) == (1 << 31), 25 decInt64_1 = (~(-1L)) == 0, 26 decInt64_2 = (~4294967295L) != 0, 27 decInt64_3 = (~4294967295) != 0, 28 decInt64_4 = -(1L << 63) == (1L << 63), 29 30 // hex literals could be int or long 31 // 0x7fffffff is int, hence can be negated 32 hexInt32_1 = -0x7fffffff < 0, 33 34 // 0x80000000 is int32_t max + 1 35 hexInt32_2 = -0x80000000 < 0, 36 37 // 0xFFFFFFFF is int32_t, not long; if it were long then ~(long)0xFFFFFFFF != 0 38 hexInt32_3 = ~0xFFFFFFFF == 0, 39 40 // 0x7FFFFFFFFFFFFFFF is long, hence can be negated 41 hexInt64_1 = -0x7FFFFFFFFFFFFFFF < 0 42 } 43 44