1 | #include "duckdb/common/constants.hpp" |
---|---|
2 | |
3 | #include "duckdb/common/limits.hpp" |
4 | #include "duckdb/common/vector_size.hpp" |
5 | #include "duckdb/common/serializer.hpp" |
6 | |
7 | namespace duckdb { |
8 | |
9 | constexpr const idx_t DConstants::INVALID_INDEX; |
10 | const row_t MAX_ROW_ID = 4611686018427388000ULL; // 2^62 |
11 | const column_t COLUMN_IDENTIFIER_ROW_ID = (column_t)-1; |
12 | const sel_t ZERO_VECTOR[STANDARD_VECTOR_SIZE] = {0}; |
13 | const double PI = 3.141592653589793; |
14 | |
15 | const transaction_t TRANSACTION_ID_START = 4611686018427388000ULL; // 2^62 |
16 | const transaction_t MAX_TRANSACTION_ID = NumericLimits<transaction_t>::Maximum(); // 2^63 |
17 | const transaction_t NOT_DELETED_ID = NumericLimits<transaction_t>::Maximum() - 1; // 2^64 - 1 |
18 | const transaction_t MAXIMUM_QUERY_ID = NumericLimits<transaction_t>::Maximum(); // 2^64 |
19 | |
20 | bool IsPowerOfTwo(uint64_t v) { |
21 | return (v & (v - 1)) == 0; |
22 | } |
23 | |
24 | uint64_t NextPowerOfTwo(uint64_t v) { |
25 | v--; |
26 | v |= v >> 1; |
27 | v |= v >> 2; |
28 | v |= v >> 4; |
29 | v |= v >> 8; |
30 | v |= v >> 16; |
31 | v |= v >> 32; |
32 | v++; |
33 | return v; |
34 | } |
35 | |
36 | uint64_t PreviousPowerOfTwo(uint64_t v) { |
37 | return NextPowerOfTwo(v: (v / 2) + 1); |
38 | } |
39 | |
40 | bool IsInvalidSchema(const string &str) { |
41 | return str.empty(); |
42 | } |
43 | |
44 | bool IsInvalidCatalog(const string &str) { |
45 | return str.empty(); |
46 | } |
47 | |
48 | bool IsRowIdColumnId(column_t column_id) { |
49 | return column_id == COLUMN_IDENTIFIER_ROW_ID; |
50 | } |
51 | |
52 | } // namespace duckdb |
53 |