Skip to content

Commit 79509cf

Browse files
committed
Use inline constexpr as suggested by Adriano. Misc style changes.
1 parent 10c180a commit 79509cf

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/jrd/optimizer/Optimizer.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,30 @@ namespace Jrd {
4646

4747
// AB: 2005-11-05
4848
// Constants below needs some discussions and ideas
49-
constexpr double REDUCE_SELECTIVITY_FACTOR_EQUALITY = 0.001;
50-
constexpr double REDUCE_SELECTIVITY_FACTOR_BETWEEN = 0.0025;
51-
constexpr double REDUCE_SELECTIVITY_FACTOR_LESS = 0.05;
52-
constexpr double REDUCE_SELECTIVITY_FACTOR_GREATER = 0.05;
53-
constexpr double REDUCE_SELECTIVITY_FACTOR_STARTING = 0.01;
54-
constexpr double REDUCE_SELECTIVITY_FACTOR_OTHER = 0.01;
49+
inline constexpr double REDUCE_SELECTIVITY_FACTOR_EQUALITY = 0.001;
50+
inline constexpr double REDUCE_SELECTIVITY_FACTOR_BETWEEN = 0.0025;
51+
inline constexpr double REDUCE_SELECTIVITY_FACTOR_LESS = 0.05;
52+
inline constexpr double REDUCE_SELECTIVITY_FACTOR_GREATER = 0.05;
53+
inline constexpr double REDUCE_SELECTIVITY_FACTOR_STARTING = 0.01;
54+
inline constexpr double REDUCE_SELECTIVITY_FACTOR_OTHER = 0.01;
5555

5656
// Cost of simple (CPU bound) operations is less than the page access cost
57-
constexpr double COST_FACTOR_MEMCOPY = 0.5;
58-
constexpr double COST_FACTOR_HASHING = 0.5;
59-
constexpr double COST_FACTOR_QUICKSORT = 0.1;
57+
inline constexpr double COST_FACTOR_MEMCOPY = 0.5;
58+
inline constexpr double COST_FACTOR_HASHING = 0.5;
59+
inline constexpr double COST_FACTOR_QUICKSORT = 0.1;
6060

61-
constexpr double MAXIMUM_SELECTIVITY = 1.0;
62-
constexpr double DEFAULT_SELECTIVITY = 0.1;
61+
inline constexpr double MAXIMUM_SELECTIVITY = 1.0;
62+
inline constexpr double DEFAULT_SELECTIVITY = 0.1;
6363

64-
constexpr double MINIMUM_CARDINALITY = 1.0;
65-
constexpr double THRESHOLD_CARDINALITY = 5.0;
66-
constexpr double DEFAULT_CARDINALITY = 1000.0;
64+
inline constexpr double MINIMUM_CARDINALITY = 1.0;
65+
inline constexpr double THRESHOLD_CARDINALITY = 5.0;
66+
inline constexpr double DEFAULT_CARDINALITY = 1000.0;
6767

6868
// Default depth of an index tree (including one leaf page),
6969
// also representing the minimal cost of the index scan.
7070
// We assume that the root page would be always cached,
7171
// so it's not included here.
72-
const double DEFAULT_INDEX_COST = 3.0;
72+
inline const double DEFAULT_INDEX_COST = 3.0;
7373

7474

7575
struct index_desc;

src/jrd/optimizer/Retrieval.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ IndexTableScan* Retrieval::getNavigation(const InversionCandidate* candidate)
449449
}
450450

451451
if (sortCost < navigationCost)
452-
return NULL;
452+
return nullptr;
453453
}
454454
}
455455

@@ -458,13 +458,13 @@ IndexTableScan* Retrieval::getNavigation(const InversionCandidate* candidate)
458458
// a navigational rsb for it.
459459
scratch->index->idx_runtime_flags |= idx_navigate;
460460

461-
const USHORT key_length =
462-
ROUNDUP(BTR_key_length(tdbb, relation, scratch->index), sizeof(SLONG));
461+
const auto indexNode = makeIndexScanNode(scratch);
463462

464-
InversionNode* const index_node = makeIndexScanNode(scratch);
463+
const USHORT keyLength =
464+
ROUNDUP(BTR_key_length(tdbb, relation, scratch->index), sizeof(SLONG));
465465

466466
return FB_NEW_POOL(getPool())
467-
IndexTableScan(csb, getAlias(), stream, relation, index_node, key_length,
467+
IndexTableScan(csb, getAlias(), stream, relation, indexNode, keyLength,
468468
navigationCandidate->selectivity);
469469
}
470470

0 commit comments

Comments
 (0)