From 62e2c752e5714949aaa857318265e29195344803 Mon Sep 17 00:00:00 2001 From: vrld Date: Sat, 1 Dec 2012 14:00:05 +0100 Subject: [PATCH] More verbose VertexIndex::getType() (using numeric_limits) --- src/modules/graphics/opengl/VertexBuffer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/VertexBuffer.cpp b/src/modules/graphics/opengl/VertexBuffer.cpp index 645f55a5b..8837ea5f5 100644 --- a/src/modules/graphics/opengl/VertexBuffer.cpp +++ b/src/modules/graphics/opengl/VertexBuffer.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace love { @@ -277,7 +278,8 @@ GLenum VertexIndex::getType(size_t s) const { // Calculates if unsigned short is big enough to hold all the vertex indices. static const GLenum type_table[] = {GL_UNSIGNED_SHORT, GL_UNSIGNED_INT}; - return type_table[int(GLushort(-1) < s * 4)]; + return type_table[s * 4 > std::numeric_limits::max()]; + // if buffer-size > max(GLushort) then GL_UNSIGNED_INT else GL_UNSIGNED_SHORT } VertexBuffer *VertexIndex::getVertexBuffer() const