1 /* 2 * Copyright (C) 2017 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 #ifndef ANDROID_ML_NN_COMMON_OPERATIONS_INTERNAL_COMPATIBILITY_H_ 18 #define ANDROID_ML_NN_COMMON_OPERATIONS_INTERNAL_COMPATIBILITY_H_ 19 20 #ifndef ANDROID_ML_NN_COMPATIBILITY 21 #define ANDROID_ML_NN_COMPATIBILITY 22 23 #include <cassert> 24 #include <cstdint> 25 26 #ifndef DCHECK 27 #define DCHECK(condition) (condition) ? (void)0 : assert(false) 28 #endif 29 30 #ifndef DCHECK_EQ 31 #define DCHECK_EQ(x, y) ((x) == (y)) ? (void)0 : assert(false) 32 #endif 33 34 #ifndef DCHECK_GE 35 #define DCHECK_GE(x, y) ((x) >= (y)) ? (void)0 : assert(false) 36 #endif 37 38 #ifndef DCHECK_GT 39 #define DCHECK_GT(x, y) ((x) > (y)) ? (void)0 : assert(false) 40 #endif 41 42 #ifndef DCHECK_LE 43 #define DCHECK_LE(x, y) ((x) <= (y)) ? (void)0 : assert(false) 44 #endif 45 46 #ifndef DCHECK_LT 47 #define DCHECK_LT(x, y) ((x) < (y)) ? (void)0 : assert(false) 48 #endif 49 50 #ifndef CHECK_EQ 51 #define CHECK_EQ(x, y) ((x) == (y)) ? (void)0 : assert(false) 52 #endif 53 54 using uint8 = std::uint8_t; 55 using int16 = std::int16_t; 56 using uint16 = std::uint16_t; 57 using int32 = std::int32_t; 58 using uint32 = std::uint32_t; 59 60 #endif 61 62 #endif // ANDROID_ML_NN_COMMON_OPERATIONS_INTERNAL_COMPATIBILITY_H_ 63