2016-08-30 20:27:56 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2016-08-13 02:39:44 +02:00
|
|
|
package android.hardware.tests.expression@1.0;
|
|
|
|
@hal_type(type="LIGHT")
|
|
|
|
interface IExpression {
|
2016-08-19 00:09:28 +02:00
|
|
|
enum UInt64LiteralTypeGuessing : uint64_t {
|
|
|
|
noSuffixDec1 = 0,
|
|
|
|
noSuffixDec2 = 1,
|
|
|
|
noSuffixDec3 = -1,
|
|
|
|
noSuffixDec4 = ~0,
|
|
|
|
noSuffixDec5 = 2147483647,
|
|
|
|
noSuffixDec6 = -2147483648,
|
|
|
|
noSuffixDec7 = 2147483648,
|
|
|
|
noSuffixDec8 = -2147483649,
|
|
|
|
noSuffixDec9 = ~(-1),
|
|
|
|
noSuffixHex1 = 0x7fffffff,
|
|
|
|
noSuffixHex2 = 0x80000000,
|
|
|
|
noSuffixHex3 = 0xffffffff,
|
|
|
|
longHex1 = 0xffffffffl,
|
|
|
|
longHex2 = 0xfffffffff,
|
|
|
|
longHex3 = 0x7fffffffffffffff,
|
|
|
|
longHex4 = 0x8000000000000000,
|
|
|
|
longHex5 = 0xFFFFFFFFFFFFFFFF,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SuffixedLiteralTypeGuessing : int32_t {
|
|
|
|
// Should be all true / ones.
|
|
|
|
// dec literals are either int32_t or int64_t
|
|
|
|
decInt32_1 = (~(-1)) == 0,
|
|
|
|
decInt32_2 = -(1 << 31) == (1 << 31),
|
|
|
|
decInt64_1 = (~(-1l)) == 0,
|
|
|
|
decInt64_2 = (~4294967295) != 0,
|
|
|
|
decInt64_3 = (~4294967295l) != 0,
|
|
|
|
decInt64_4 = -(1l << 63) == (1l << 63),
|
|
|
|
// hex literals could be (u)int32_t or (u)int64_t
|
|
|
|
// 0x7fffffff is int32_t, hence can be negated
|
|
|
|
hexInt32_1 = -0x7fffffff < 0,
|
|
|
|
// 0x80000000 is uint32_t; if it were int32_t then -(int32_t)0x80000000 == (int32_t)0x80000000 > 0
|
|
|
|
hexUInt32_1 = -0x80000000 > 0,
|
|
|
|
// 0xFFFFFFFF is uint32_t, not int64_t; if it were int64_t then ~(int64_t)0xFFFFFFFF != 0
|
|
|
|
hexUInt32_2 = ~0xFFFFFFFF == 0,
|
|
|
|
// 0x7FFFFFFFFFFFFFFF is int64_t, hence can be negated
|
|
|
|
hexInt64_1 = -0x7FFFFFFFFFFFFFFF < 0,
|
|
|
|
// 0x8000000000000000 is uint64_t
|
|
|
|
hexUInt64_1 = -0x8000000000000000 > 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Int64LiteralTypeGuessing : int64_t {
|
|
|
|
// both treated int32_t, sum = (int64_t)(int32_t)0x80000000 = (int64_t)(-2147483648)
|
|
|
|
noSuffixDec11 = 1 + 0x7fffffff,
|
|
|
|
// 0x80000000 is uint32_t, sum = (int64_t)(uint32_t)0x7fffffff = (int64_t)(2147483647)
|
|
|
|
noSuffixDec12 = 0x80000000 - 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Int32BitShifting : int32_t {
|
|
|
|
// Shifting for more than 31 bits are undefined. Not tested.
|
|
|
|
int32BitShift1 = 1 << 31,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum UInt32BitShifting : uint32_t {
|
|
|
|
uint32BitShift1 = 1 << 31,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Int64BitShifting : int64_t {
|
|
|
|
int64BitShift1 = 1l << 63,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum UInt64BitShifting : uint64_t {
|
|
|
|
uint64BitShift1 = 1l << 63,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Precedence : int32_t {
|
2016-08-13 02:39:44 +02:00
|
|
|
literal = 4,
|
2016-08-19 00:09:28 +02:00
|
|
|
neg = -4,
|
2016-08-13 02:39:44 +02:00
|
|
|
literalL = -4L,
|
2016-08-19 00:09:28 +02:00
|
|
|
hex = 0xffffffff,
|
|
|
|
hexLong = 0xffffffffl,
|
|
|
|
hexLong2 = 0xfffffffff,
|
2016-08-13 02:39:44 +02:00
|
|
|
simpleArithmetic = 4 + 1,
|
2016-08-19 00:09:28 +02:00
|
|
|
simpleArithmetic2 = 2 + 3 - 4,
|
|
|
|
simpleBoolExpr = 1 == 4,
|
|
|
|
simpleLogical = 1 && 1,
|
|
|
|
simpleComp = 1 < 2,
|
|
|
|
boolExpr1 = !((3 != 4 || (2 < 3 <= 3 > 4)) >= 0),
|
2016-08-13 02:39:44 +02:00
|
|
|
boolExpr = 1 == 7 && !((3 != 4 || (2 < 3 <= 3 > 4)) >= 0),
|
2016-08-19 00:09:28 +02:00
|
|
|
simpleBitShift = 1 << 2,
|
|
|
|
simpleBitShift2 = 4 >> 1,
|
|
|
|
simpleBitShiftNeg = 4 << -1,
|
|
|
|
simpleArithmeticRightShift = 1 << 31 >> 31,
|
|
|
|
simpleBitExpr = 1 | 16 >> 2,
|
2016-08-13 02:39:44 +02:00
|
|
|
bitExpr = ~42 & (1 << 3 | 16 >> 2) ^ 7,
|
|
|
|
arithmeticExpr = 2 + 3 - 4 * -7 / (10 % 3),
|
2016-08-19 00:09:28 +02:00
|
|
|
messyExpr = 2 + (-3&4 / 7),
|
2016-08-13 02:39:44 +02:00
|
|
|
paranExpr = (((((1 + 1))))),
|
|
|
|
ternary = 1?2:3,
|
|
|
|
ternary2 = 1&&2?3:4,
|
2016-08-19 00:09:28 +02:00
|
|
|
complicatedTernary2 = 1 - 1 && 2 + 3 || 5 ? 7 * 8 : -3,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum OperatorSanityCheck : int32_t {
|
|
|
|
// Should be all true / ones.
|
|
|
|
plus = (1 + 2) == 3,
|
|
|
|
minus = (8 - 9) == -1,
|
|
|
|
product = (9 * 9) == 81,
|
|
|
|
division = (29 / 3) == 9,
|
|
|
|
mod = (29 % 3) == 2,
|
|
|
|
bit_or = (0xC0010000 | 0xF00D) == (0xC001F00D),
|
|
|
|
bit_or2 = (10 | 6) == 14,
|
|
|
|
bit_and = (10 & 6) == 2,
|
|
|
|
bit_xor = (10 ^ 6) == 12,
|
|
|
|
lt1 = 6 < 10,
|
|
|
|
lt2 = (10 < 10) == 0,
|
|
|
|
gt1 = (6 > 10) == 0,
|
|
|
|
gt2 = (10 > 10) == 0,
|
|
|
|
gte1 = 19 >= 10,
|
|
|
|
gte2 = 10 >= 10,
|
|
|
|
lte1 = 5 <= 10,
|
|
|
|
lte2 = (19 <= 10) == 0,
|
|
|
|
ne1 = 19 != 10,
|
|
|
|
ne2 = (10 != 10) == 0,
|
|
|
|
lshift = (22 << 1) == 44,
|
|
|
|
rshift = (11 >> 1) == 5,
|
|
|
|
logor1 = (1 || 0) == 1,
|
|
|
|
logor2 = (1 || 1) == 1,
|
|
|
|
logor3 = (0 || 0) == 0,
|
|
|
|
logor4 = (0 || 1) == 1,
|
|
|
|
logand1 = (1 && 0) == 0,
|
|
|
|
logand2 = (1 && 1) == 1,
|
|
|
|
logand3 = (0 && 0) == 0,
|
|
|
|
logand4 = (0 && 1) == 0,
|
|
|
|
};
|
|
|
|
|
2016-08-13 02:39:44 +02:00
|
|
|
};
|