1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_INLINES_H_
6 #define FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_INLINES_H_
7
8 #include <lib/syslog/global.h>
9
10 namespace dart_utils {
11
12 inline void Check(bool condition, const char* tag, const char* message = "") {
13 if (!condition) {
14 FX_LOG(FATAL, tag, message);
15 }
16 }
17
18 #ifndef NDEBUG
19 #define DEBUG_CHECK(condition, tag, message) \
20 dart_utils::Check(condition, tag, message)
21 #else
22 #define DEBUG_CHECK(condition, tag, message) (true || (condition))
23 #endif
24
25 template <size_t SIZE, typename T>
ArraySize(T (& array)[SIZE])26 inline size_t ArraySize(T (&array)[SIZE]) {
27 return SIZE;
28 }
29
30 } // namespace dart_utils
31
32 #endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_INLINES_H_
33