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
7namespace duckdb {
8
9constexpr const idx_t DConstants::INVALID_INDEX;
10const row_t MAX_ROW_ID = 4611686018427388000ULL; // 2^62
11const column_t COLUMN_IDENTIFIER_ROW_ID = (column_t)-1;
12const sel_t ZERO_VECTOR[STANDARD_VECTOR_SIZE] = {0};
13const double PI = 3.141592653589793;
14
15const transaction_t TRANSACTION_ID_START = 4611686018427388000ULL; // 2^62
16const transaction_t MAX_TRANSACTION_ID = NumericLimits<transaction_t>::Maximum(); // 2^63
17const transaction_t NOT_DELETED_ID = NumericLimits<transaction_t>::Maximum() - 1; // 2^64 - 1
18const transaction_t MAXIMUM_QUERY_ID = NumericLimits<transaction_t>::Maximum(); // 2^64
19
20bool IsPowerOfTwo(uint64_t v) {
21 return (v & (v - 1)) == 0;
22}
23
24uint64_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
36uint64_t PreviousPowerOfTwo(uint64_t v) {
37 return NextPowerOfTwo(v: (v / 2) + 1);
38}
39
40bool IsInvalidSchema(const string &str) {
41 return str.empty();
42}
43
44bool IsInvalidCatalog(const string &str) {
45 return str.empty();
46}
47
48bool IsRowIdColumnId(column_t column_id) {
49 return column_id == COLUMN_IDENTIFIER_ROW_ID;
50}
51
52} // namespace duckdb
53