refactor: rm redundanct aliases, add size_t -> usize alias
| 5 files changed, 8 insertions(+), 19 deletions(-) | |||
|---|---|---|---|
| M | src/clip.cpp | +1 | -1 |
| M | src/clip.h | +1 | -0 |
| M | src/globals.h | +1 | -0 |
| M | src/renderer.h | +1 | -14 |
| M | src/util_string.h | +4 | -4 |
1@@ -65,7 +65,7 @@ vector<ClipVertex> clip_against_plane(
2 bool prev_inside = (prev_dist >= 0.0f);
3
4 // loop over each vertex to compare
5- for (size_t i = 0; i < polygon_in.size(); ++i) {
6+ for (usize i = 0; i < polygon_in.size(); ++i) {
7 const ClipVertex &curr_vert = polygon_in[i];
8 float curr_dist = plane_dist(curr_vert.pos);
9 bool curr_inside = (curr_dist >= 0.0f);
M · src/clip.h
+1, -01@@ -1,5 +1,6 @@
2 #include <vector>
3
4+#include "globals.h"
5 #include "util_math.h"
6
7 using std::vector;
M · src/globals.h
+1, -01@@ -12,6 +12,7 @@ typedef uint32_t u32;
2 typedef uint64_t u64;
3 typedef float f32;
4 typedef double f64;
5+typedef size_t usize;
6
7 #define static_global static
8 #define static_local static
M · src/renderer.h
+1, -14 1@@ -3,20 +3,7 @@
2 #include <SDL.h>
3 #include <stdint.h>
4
5-typedef int8_t i8;
6-typedef int16_t i16;
7-typedef int32_t i32;
8-typedef int64_t i64;
9-typedef uint8_t u8;
10-typedef uint16_t u16;
11-typedef uint32_t u32;
12-typedef uint64_t u64;
13-typedef float f32;
14-typedef double f64;
15-
16-#define static_global static
17-#define static_local static
18-#define static_internal static
19+#include "globals.h"
20
21 // could manually blit instead of using SDL_Renderer, but there's no point?
22 // GPU gets used to composite the window anyway.
M · src/util_string.h
+4, -4 1@@ -22,8 +22,8 @@ inline string string_from_cstr(char *cstr) {
2 }
3
4 inline void string_trim(string *s) {
5- size_t start = 0;
6- size_t end = s->size;
7+ usize start = 0;
8+ usize end = s->size;
9 while (start < end &&
10 (s->str[start] == ' ' || s->str[start] == '\t' ||
11 s->str[start] == '\r' || s->str[start] == '\n')) {
12@@ -39,7 +39,7 @@ inline void string_trim(string *s) {
13 }
14
15 inline bool string_starts_with(const string &s, const char *prefix) {
16- size_t len = strlen(prefix);
17+ usize len = strlen(prefix);
18 if (s.size < len) {
19 return false;
20 }
21@@ -50,7 +50,7 @@ inline bool string_equals(string a, string b) {
22 if (a.size != b.size) {
23 return false;
24 }
25- for (uint32_t i = 0; i < a.size; ++i) {
26+ for (u32 i = 0; i < a.size; ++i) {
27 if (a.str[i] != b.str[i]) {
28 return false;
29 }