various fixes for clang
Before adoption: this commit came in with the history the project adopted, so no landing records it.
also fix a comment typo
authored by Sean Barrett · committed by Sean Barrett · parent 5715e6f · Browse files · 5 files·+22 added−32 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+22 added−32 removed
- other:+22 added−32 removed
Provenance
- Commit
5fe7fb5- Tree
bb938b3- Author
Sean Barrett <sean@nothings.org>- Committer
Sean Barrett <sean@nothings.org>- Parent
5715e6f
5 files changed+22 added−32 removed
modified:stb_divide.h+6 added-5 removed
161 unmodified lines162 {163 #ifdef C_INTEGER_DIVISION_FLOORS164 return v1/v2;165 #else166- if (v1 >= 0 && v2 < 0)166+ if (v1 >= 0 && v2 < 0) {167 if ((-v1)+v2+1 < 0) // check if increasing v1's magnitude overflows168 return -stb__div(-v1+v2+1,v2); // nope, so just compute it169 else170 return -stb__div(-v1,v2) + ((-v1)%v2 ? -1 : 0);171+ }171- if (v1 < 0 && v2 >= 0)172- if (v1 != INT_MIN)172+ if (v1 < 0 && v2 >= 0) {173+ if (v1 != INT_MIN) {174 if (v1-v2+1 < 0) // check if increasing v1's magnitude overflows175 return -stb__div(v1-v2+1,-v2); // nope, so just compute it176 else177 return -stb__div(-v1,v2) + (stb__mod(v1,-v2) ? -1 : 0);177- else // it must be possible to compute -(v1+v2) without overflowing178+ } else // it must be possible to compute -(v1+v2) without overflowing179 return -stb__div(-(v1+v2),v2) + (stb__mod(-(v1+v2),v2) ? -2 : -1);179- else180+ } else181 return v1/v2; // same sign, so expect truncation182 #endif183 }184 236 unmodified linesmodified:stb_image.h+1 added-1 removed
166 unmodified lines167 //168 // If compiling for Windows and you wish to use Unicode filenames, compile169 // with170 // #define STBI_WINDOWS_UTF8171-// and pass utf8-encoded filenames. Call stbiw_convert_wchar_to_utf8 to convert171+// and pass utf8-encoded filenames. Call stbi_convert_wchar_to_utf8 to convert172 // Windows wchar_t filenames to utf8.173 //174 // ===========================================================================175 //7354 unmodified linesmodified:stb_tilemap_editor.h+5 added-3 removed
1059 unmodified lines1060 1061 void stbte_set_background_tile(stbte_tilemap *tm, short id)1062 {1063 int i;1064- STBTE_ASSERT(id >= -1 && id < 32768);1065- if (id >= 32768 || id < -1)1064+ STBTE_ASSERT(id >= -1);1065+ // STBTE_ASSERT(id < 32768);1066+ if (id < -1)1067 return;1068 for (i=0; i < STBTE_MAX_TILEMAP_X * STBTE_MAX_TILEMAP_Y; ++i)1069 if (tm->data[0][i][0] == -1)1070 tm->data[0][i][0] = id;151 unmodified lines1222 void stbte_set_tile(stbte_tilemap *tm, int x, int y, int layer, signed short tile)1223 {1224 STBTE_ASSERT(x >= 0 && x < tm->max_x && y >= 0 && y < tm->max_y);1225 STBTE_ASSERT(layer >= 0 && layer < tm->num_layers);1225- STBTE_ASSERT(tile >= -1 && tile < 32768);1226+ STBTE_ASSERT(tile >= -1);1227+ //STBTE_ASSERT(tile < 32768);1228 if (x < 0 || x >= STBTE_MAX_TILEMAP_X || y < 0 || y >= STBTE_MAX_TILEMAP_Y)1229 return;1230 if (layer < 0 || layer >= tm->num_layers || tile < -1)1231 return;2945 unmodified linesmodified:stb_truetype.h-13 removed
241 unmodified lines242 // given file is in a general way. I provide an API for this, but I don't243 // recommend it.244 //245 //246-// SOURCE STATISTICS (based on v0.6c, 2050 LOC)247-//248-// Documentation & header file 520 LOC )___ 660 LOC documentation249-// Sample code 140 LOC )250-// Truetype parsing 620 LOC ---- 620 LOC TrueType251-// Software rasterization 240 LOC )252-// Curve tessellation 120 LOC )___ 550 LOC Bitmap creation253-// Bitmap management 100 LOC )254-// Baked bitmap interface 70 LOC )255-// Font name matching & access 150 LOC ---- 150 256-// C runtime library abstraction 60 LOC ---- 60257-//258-//246 // PERFORMANCE MEASUREMENTS FOR 1.06:247 //248 // 32-bit 64-bit249 // Previous release: 8.83 s 7.68 s4632 unmodified linesmodified:stb_voxel_render.h+10 added-10 removed
2368 unmodified lines2369 static unsigned short stbvox_face_visible[STBVOX_FT_count] =2370 {2371 // we encode the table by listing which cases cause *obscuration*, and bitwise inverting that2372 // table is pre-shifted by 5 to save a shift when it's accessed2373- (unsigned short) ((~0x07ff )<<5), // none is completely obscured by everything2374- (unsigned short) ((~((1<<STBVOX_FT_solid) | (1<<STBVOX_FT_upper) ))<<5), // upper2375- (unsigned short) ((~((1<<STBVOX_FT_solid) | (1<<STBVOX_FT_lower) ))<<5), // lower2376- (unsigned short) ((~((1<<STBVOX_FT_solid) ))<<5), // solid is only completely obscured only by solid2377- (unsigned short) ((~((1<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_013)))<<5), // diag012 matches diag0132378- (unsigned short) ((~((1<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_123)))<<5), // diag023 matches diag1232379- (unsigned short) ((~((1<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_012)))<<5), // diag013 matches diag0122380- (unsigned short) ((~((1<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_023)))<<5), // diag123 matches diag0232381- (unsigned short) ((~0 )<<5), // force is always rendered regardless, always forces neighbor2382- (unsigned short) ((~((1<<STBVOX_FT_solid) ))<<5), // partial is only completely obscured only by solid2373+ (unsigned short) ((~0x07ffu )<<5), // none is completely obscured by everything2374+ (unsigned short) ((~((1u<<STBVOX_FT_solid) | (1<<STBVOX_FT_upper) ))<<5), // upper2375+ (unsigned short) ((~((1u<<STBVOX_FT_solid) | (1<<STBVOX_FT_lower) ))<<5), // lower2376+ (unsigned short) ((~((1u<<STBVOX_FT_solid) ))<<5), // solid is only completely obscured only by solid2377+ (unsigned short) ((~((1u<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_013)))<<5), // diag012 matches diag0132378+ (unsigned short) ((~((1u<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_123)))<<5), // diag023 matches diag1232379+ (unsigned short) ((~((1u<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_012)))<<5), // diag013 matches diag0122380+ (unsigned short) ((~((1u<<STBVOX_FT_solid) | (1<<STBVOX_FT_diag_023)))<<5), // diag123 matches diag0232381+ (unsigned short) ((~0u )<<5), // force is always rendered regardless, always forces neighbor2382+ (unsigned short) ((~((1u<<STBVOX_FT_solid) ))<<5), // partial is only completely obscured only by solid2383 };2384 2385 // the vertex heights of the block types, in binary vertex order (zyx):2386 // lower: SW, SE, NW, NE; upper: SW, SE, NW, NE1418 unmodified lines