瀏覽代碼

core: fix a few build warnings and remove useless operators from the

"half" class. The build is now 3% faster.
legacy
Sam Hocevar sam 13 年之前
父節點
當前提交
c035a1c2b7
共有 5 個文件被更改,包括 11 次插入15 次删除
  1. +2
    -0
      src/entity.cpp
  2. +1
    -1
      src/layer.cpp
  3. +2
    -4
      src/lol/math/half.h
  4. +6
    -6
      src/ticker.cpp
  5. +0
    -4
      test/tutorial/01_triangle.cpp

+ 2
- 0
src/entity.cpp 查看文件

@@ -52,6 +52,7 @@ char const *Entity::GetName()


void Entity::TickGame(float seconds) void Entity::TickGame(float seconds)
{ {
(void)seconds;
#if !LOL_RELEASE #if !LOL_RELEASE
if (m_tickstate != STATE_PRETICK_GAME) if (m_tickstate != STATE_PRETICK_GAME)
Log::Error("invalid entity game tick\n"); Log::Error("invalid entity game tick\n");
@@ -61,6 +62,7 @@ void Entity::TickGame(float seconds)


void Entity::TickDraw(float seconds) void Entity::TickDraw(float seconds)
{ {
(void)seconds;
#if !LOL_RELEASE #if !LOL_RELEASE
if (m_tickstate != STATE_PRETICK_DRAW) if (m_tickstate != STATE_PRETICK_DRAW)
Log::Error("invalid entity draw tick\n"); Log::Error("invalid entity draw tick\n");


+ 1
- 1
src/layer.cpp 查看文件

@@ -45,7 +45,7 @@ Layer::~Layer()
free(data); free(data);
} }


void Layer::Render(int x, int y, int z)
void Layer::Render(int /* x */, int /* y */, int /* z */)
{ {
static int error = 1; static int error = 1;
if (error && !(error = 0)) if (error && !(error = 0))


+ 2
- 4
src/lol/math/half.h 查看文件

@@ -156,10 +156,8 @@ static inline half clamp(half x, half a, half b)
#define DECLARE_COERCE_FROM_HALF_OPS(type) \ #define DECLARE_COERCE_FROM_HALF_OPS(type) \
DECLARE_COERCE_HALF_OPS(type, type, x, (type)h) DECLARE_COERCE_HALF_OPS(type, type, x, (type)h)


DECLARE_COERCE_TO_HALF_OPS(int8_t)
DECLARE_COERCE_TO_HALF_OPS(uint8_t)
DECLARE_COERCE_TO_HALF_OPS(int16_t)
DECLARE_COERCE_TO_HALF_OPS(uint16_t)
/* Only provide coercion rules above int32_t, since the standard says
* all smaller base types are coerced to int. */
DECLARE_COERCE_TO_HALF_OPS(int32_t) DECLARE_COERCE_TO_HALF_OPS(int32_t)
DECLARE_COERCE_TO_HALF_OPS(uint32_t) DECLARE_COERCE_TO_HALF_OPS(uint32_t)
DECLARE_COERCE_TO_HALF_OPS(int64_t) DECLARE_COERCE_TO_HALF_OPS(int64_t)


+ 6
- 6
src/ticker.cpp 查看文件

@@ -151,7 +151,7 @@ int Ticker::Unref(Entity *entity)
return --entity->m_ref; return --entity->m_ref;
} }


void *TickerData::GameThreadMain(void *p)
void *TickerData::GameThreadMain(void * /* p */)
{ {
for (;;) for (;;)
{ {
@@ -296,7 +296,7 @@ void *TickerData::GameThreadMain(void *p)
return NULL; return NULL;
} }


void *TickerData::DrawThreadMain(void *p)
void *TickerData::DrawThreadMain(void * /* p */)
{ {
for (;;) for (;;)
{ {
@@ -310,18 +310,18 @@ void *TickerData::DrawThreadMain(void *p)
return NULL; return NULL;
} }


void *TickerData::DiskThreadMain(void *p)
void *TickerData::DiskThreadMain(void * /* p */)
{ {
return NULL; return NULL;
} }


void Ticker::SetState(Entity *entity, uint32_t state)
void Ticker::SetState(Entity * /* entity */, uint32_t /* state */)
{ {


} }


void Ticker::SetStateWhenMatch(Entity *entity, uint32_t state,
Entity *other_entity, uint32_t other_state)
void Ticker::SetStateWhenMatch(Entity * /* entity */, uint32_t /* state */,
Entity * /* other_entity */, uint32_t /* other_state */)
{ {


} }


+ 0
- 4
test/tutorial/01_triangle.cpp 查看文件

@@ -22,10 +22,6 @@ using namespace lol;
# include <SDL_main.h> # include <SDL_main.h>
#endif #endif


#if defined __native_client__
# define main old_main
#endif

#if defined _WIN32 #if defined _WIN32
# undef main /* FIXME: still needed? */ # undef main /* FIXME: still needed? */
# include <direct.h> # include <direct.h>


Loading…
取消
儲存