Quellcode durchsuchen

Fix several compilation warnings.

legacy
Sam Hocevar vor 7 Jahren
Ursprung
Commit
c826bbd6f0
3 geänderte Dateien mit 16 neuen und 15 gelöschten Zeilen
  1. +4
    -4
      src/lol/sys/threadtypes.h
  2. +3
    -3
      src/lol/sys/timer.h
  3. +9
    -8
      src/math/real.cpp

+ 4
- 4
src/lol/sys/threadtypes.h Datei anzeigen

@@ -97,7 +97,7 @@ protected:
class BaseThreadManager : public Entity
{
public:
char const *GetName() { return "<BaseThreadManager>"; }
std::string GetName() const { return "<BaseThreadManager>"; }
BaseThreadManager(int thread_max);
BaseThreadManager(int thread_max, int thread_min);
virtual ~BaseThreadManager();
@@ -163,7 +163,7 @@ private:
class DefaultThreadManager : public BaseThreadManager
{
public:
char const *GetName() { return "<DefaultThreadManager>"; }
std::string GetName() const { return "<DefaultThreadManager>"; }
DefaultThreadManager(int thread_max)
: BaseThreadManager(thread_max, thread_max)
{ }
@@ -222,7 +222,7 @@ public:
}
};
public:
char const *GetName() { return "<FileUpdateTester>"; }
std::string GetName() const { return "<FileUpdateTester>"; }
FileUpdateTester(uint32_t frame_skip = 4)
: BaseThreadManager(1)
{ m_frame_skip = frame_skip; }
@@ -252,7 +252,7 @@ typedef FileUpdateTester::Status FileUpdateStatus;
class AsyncImageLoader : public BaseThreadManager
{
public:
char const *GetName() { return "<AsyncImageLoader>"; }
std::string GetName() const { return "<AsyncImageLoader>"; }
AsyncImageLoader(int thread_max)
: BaseThreadManager(thread_max, 0)
{


+ 3
- 3
src/lol/sys/timer.h Datei anzeigen

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010—2018 Sam Hocevar <sam@hocevar.net>
// © 2016 Guillaume Bittoun <guillaume.bittoun@gmail.com>
//
// Lol Engine is free software. It comes without any warranty, to
@@ -45,11 +45,11 @@ public:
private:
std::chrono::steady_clock::time_point m_tp;

float get_seconds(bool reset)
float get_seconds(bool do_reset)
{
auto tp = std::chrono::steady_clock::now(), tp0 = m_tp;

if (reset)
if (do_reset)
m_tp = tp;

return std::chrono::duration_cast<std::chrono::duration<float>>(tp - tp0).count();


+ 9
- 8
src/math/real.cpp Datei anzeigen

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2017 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010—2018 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
@@ -22,7 +22,11 @@ namespace lol

/*
* First handle explicit specialisation of our templates.
*
*/

template<> int real::DEFAULT_BIGIT_COUNT = 16;

/*
* Initialisation order is not important because everything is
* done on demand, but here is the dependency list anyway:
* - fast_log() requires R_1
@@ -89,9 +93,6 @@ LOL_CONSTANT_GETTER(R_SQRT1_2, R_SQRT2() / 2);
* Now carry on with the rest of the Real class.
*/

template<>
int real::DEFAULT_BIGIT_COUNT = 16;

template<> real::Real()
: m_exponent(0),
m_sign(false),
@@ -116,7 +117,7 @@ template<> real::Real(uint64_t i)
if (i)
{
/* Only works with 32-bit bigits for now */
static_assert(sizeof(bigit_t) == 4);
static_assert(sizeof(bigit_t) == 4, "bigit_t must be 32-bit");

int delta = 1;
while ((i >> 63) == 0)
@@ -155,7 +156,7 @@ template<> real::Real(double d)
break;
default:
/* Only works with 32-bit bigits for now */
static_assert(sizeof(bigit_t) == 4);
static_assert(sizeof(bigit_t) == 4, "bigit_t must be 32-bit");
m_exponent = exponent - ((1 << 10) - 1);
m_mantissa.resize(DEFAULT_BIGIT_COUNT);
m_mantissa[0] = (bigit_t)(u.x >> 20);
@@ -271,7 +272,7 @@ template<> real::Real(char const *str)
finished = true;
break;
}
LOL_ATTR_FALLTHROUGH /* FIXME: why doesn’t this seem to work? */
LOL_ATTR_FALLTHROUGH;
case 'a': case 'b': case 'c': case 'd': case 'f':
case 'A': case 'B': case 'C': case 'D': case 'F':
case '0': case '1': case '2': case '3': case '4':


Laden…
Abbrechen
Speichern