diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-16 16:55:05 +0400 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-16 16:55:05 +0400 |
commit | 2144f20b04633ceb957ca9c8a82bbdbb85073503 (patch) | |
tree | cab49e236bd9a25e5669eabc0e1b91ab0e2f0854 | |
parent | c50055204df1a73583f646bba688d5f7a76531a8 (diff) |
Use bitset instead of mucking around with <<, | and &
-rw-r--r-- | source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp index eaed233b86c..2c7112e2e3c 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp @@ -60,6 +60,7 @@ #include <vector> #include <iostream> #include <algorithm> +#include <bitset> #include "STR_String.h" @@ -217,7 +218,7 @@ static void *bglGetProcAddress(const GLubyte* entry) GL Extension Manager. */ /* Bit array of available extensions */ -static unsigned int enabled_extensions[(bgl::NUM_EXTENSIONS + 8*sizeof(unsigned int) - 1)/(8*sizeof(unsigned int))]; +static std::bitset<bgl::NUM_EXTENSIONS> enabled_extensions; static std::vector<STR_String> extensions; static int m_debug; @@ -227,7 +228,7 @@ static void EnableExtension(bgl::ExtensionName name) { unsigned int num = (unsigned int) name; if (num < bgl::NUM_EXTENSIONS) - enabled_extensions[num/(8*sizeof(unsigned int))] |= (1<<(num%(8*sizeof(unsigned int)))); + enabled_extensions.set(num); } @@ -251,10 +252,10 @@ void InitExtensions(int debug) bool QueryExtension(ExtensionName name) { unsigned int num = (unsigned int) name; - if (num >= NUM_EXTENSIONS) - return false; - - return (enabled_extensions[num/(8*sizeof(unsigned int))] & (1<<(num%(8*sizeof(unsigned int))))) != 0; + if (num < NUM_EXTENSIONS) + return enabled_extensions[num]; + + return false; } bool QueryVersion(int major, int minor) |