Matt Williams avatar Matt Williams committed 9f7f893

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.

Comments (0)

Files changed (2)

library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h

 
 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

library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp

 
 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,
 		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, },
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.