• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef LIBPANDABASE_GLOBALS_H
17 #define LIBPANDABASE_GLOBALS_H
18 
19 #include <cstdint>
20 
21 namespace panda {
22 
23 static constexpr unsigned BITS_PER_BYTE = 8;
24 static constexpr unsigned BITS_PER_UINT16 = sizeof(uint16_t) * BITS_PER_BYTE;
25 static constexpr unsigned BITS_PER_UINT32 = sizeof(uint32_t) * BITS_PER_BYTE;
26 static constexpr unsigned BITS_PER_UINT64 = sizeof(uint64_t) * BITS_PER_BYTE;
27 static constexpr unsigned BITS_PER_INTPTR = sizeof(intptr_t) * BITS_PER_BYTE;
28 
29 static constexpr unsigned BITS_PER_BYTE_LOG2 = 3;
30 
31 static constexpr uint32_t PERCENT_100_U32 = 100U;
32 static constexpr double PERCENT_100_D = 100.0;
33 
34 #ifndef NDEBUG
35 static constexpr bool DEBUG_BUILD = true;
36 #else
37 static constexpr bool DEBUG_BUILD = false;
38 #endif
39 
40 }  // namespace panda
41 
42 #endif  // LIBPANDABASE_GLOBALS_H
43