From 9f7f893b68e3ba069657f98960951f992590197c Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Wed, 3 Jul 2013 19:14:00 +0100 Subject: [PATCH] Change the types of the edgeTable and triTable The range on values in these tables is much less than needs an int so making them specific width types packs them smaller. I measure a 5% decrease in the size of the .so file created at -O3. --- .../include/PolyVoxCore/Impl/MarchingCubesTables.h | 4 ++-- library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h index 3dab0ffa..19aece87 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h @@ -28,8 +28,8 @@ freely, subject to the following restrictions: namespace PolyVox { - extern const POLYVOX_API int edgeTable[256]; - extern const POLYVOX_API int triTable[256][16]; + extern const POLYVOX_API uint16_t edgeTable[256]; + extern const POLYVOX_API int8_t triTable[256][16]; } #endif diff --git a/library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp b/library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp index 38f1a56c..15769007 100644 --- a/library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp +++ b/library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp @@ -30,7 +30,7 @@ freely, subject to the following restrictions: namespace PolyVox { - const int edgeTable[256]= + const uint16_t edgeTable[256]= { 0x000, 0x109, 0x203, 0x30a, 0x80c, 0x905, 0xa0f, 0xb06, 0x406, 0x50f, 0x605, 0x70c, 0xc0a, 0xd03, 0xe09, 0xf00, @@ -66,7 +66,7 @@ namespace PolyVox 0xb06, 0xa0f, 0x905, 0x80c, 0x30a, 0x203, 0x109, 0x000 }; - const int triTable[256][16] = + const int8_t triTable[256][16] = { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, { 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, },