Skip to content

Commit

Permalink
Changed const to constexpr
Browse files Browse the repository at this point in the history
C26814: The const variable ... can be computed at compile-time.
Consider using constexpr
  • Loading branch information
javagl committed Sep 15, 2021
1 parent 17abaee commit 47d49ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace {

// One hundredth of a pixel. If we compute a rectangle that goes less than "this
// much" into the next pixel, we'll ignore the extra.
const double pixelTolerance = 0.01;
constexpr double pixelTolerance = 0.01;

} // namespace

Expand Down
6 changes: 3 additions & 3 deletions Cesium3DTilesSelection/src/QuantizedMeshContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ struct QuantizedMeshView {
};

// We can't use sizeof(QuantizedMeshHeader) because it may be padded.
const size_t headerLength = 92;
const size_t extensionHeaderLength = 5;
constexpr size_t headerLength = 92;
constexpr size_t extensionHeaderLength = 5;

int32_t zigZagDecode(int32_t value) noexcept {
return (value >> 1) ^ (-(value & 1));
Expand Down Expand Up @@ -149,7 +149,7 @@ static T readValue(
}

static glm::dvec3 octDecode(uint8_t x, uint8_t y) {
const uint8_t rangeMax = 255;
constexpr uint8_t rangeMax = 255;

glm::dvec3 result;

Expand Down
2 changes: 1 addition & 1 deletion CesiumUtility/include/CesiumUtility/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class CESIUMUTILITY_API Math final {
* @snippet TestMath.cpp convertLongitudeRange
*/
static double convertLongitudeRange(double angle) noexcept {
const double twoPi = Math::TWO_PI;
constexpr double twoPi = Math::TWO_PI;

const double simplified = angle - glm::floor(angle / twoPi) * twoPi;

Expand Down

0 comments on commit 47d49ec

Please sign in to comment.