ソースを参照

Fix multiple compilation warnings and errors

wip/image-kernel
Sam Hocevar 2年前
コミット
ea78a1bf9e
3個のファイルの変更14行の追加11行の削除
  1. +2
    -1
      include/lol/private/math/matrix.h
  2. +8
    -7
      include/lol/private/math/polynomial.h
  3. +4
    -3
      include/lol/private/math/vector.h

+ 2
- 1
include/lol/private/math/matrix.h ファイルの表示

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010–2023 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -20,6 +20,7 @@
#include "ops.h"
#include <lol/vector> // lol::vec_t
#include <ostream> // std::ostream
#include <tuple> // std::tuple
#include <cmath> // std::fabs

namespace lol


+ 8
- 7
include/lol/private/math/polynomial.h ファイルの表示

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010–2023 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -27,6 +27,7 @@
#include <tuple> // std::tuple
#include <cassert> // assert()
#include <cmath> // sqrt(), cbrt(), acos()
#include <cstddef> // std::size_t

namespace lol
{
@@ -265,13 +266,13 @@ struct [[nodiscard]] polynomial
return {};
}

/* Access individual coefficients. This is read-only and returns a
* copy because we cannot let the user mess with the integrity of
* the structure (i.e. the guarantee that the leading coefficient
* remains non-zero). */
[[nodiscard]] inline T operator[](ptrdiff_t n) const
// Access individual coefficients. This is read-only and returns a
// copy because we cannot let the user mess with the integrity of
// the structure (i.e. the guarantee that the leading coefficient
// remains non-zero).
[[nodiscard]] inline T operator[](std::size_t n) const
{
if (n < 0 || n > degree())
if (degree() < 0 || n > std::size_t(degree()))
return T(0);

return m_coefficients[n];


+ 4
- 3
include/lol/private/math/vector.h ファイルの表示

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010–2023 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -103,8 +103,9 @@ private:
*/

#define LOL_COMMON_MEMBER_OPS(first) \
inline T& operator[](size_t n) { return (&this->first)[n]; } \
inline T const& operator[](size_t n) const { return (&this->first)[n]; } \
/* Use reinterpret_cast because static_cast is illegal here */ \
inline T& operator[](size_t n) { return reinterpret_cast<T*>(this)[n]; } \
inline T const& operator[](size_t n) const { return reinterpret_cast<T const*>(this)[n]; } \
\
/* An explicit assignment operator is now mandatory */ \
inline type & operator =(type const &that) \


読み込み中…
キャンセル
保存