From c70c27dbb8d8ca636af4a61edfadba20d54150ae Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Tue, 27 Dec 2022 16:35:34 +0100 Subject: [PATCH] -Slight changes for macos --- mini.cpp | 19 +++++++++---------- opti_mac.sh | 4 ++++ 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 opti_mac.sh diff --git a/mini.cpp b/mini.cpp index 0cbba1d..70ebf66 100644 --- a/mini.cpp +++ b/mini.cpp @@ -13,7 +13,6 @@ struct surface_t { uint32_t size; }; -#define swap(a, b) {auto tmp=a;a=b;b=tmp;} char window_title[256]; uint16_t screen_width = 160; @@ -432,7 +431,7 @@ void line(int x0, int y0, int x1, int y1, uint8_t color) { } void hline(int x0, int y, int x1) { - if (x0>x1) swap(x0, x1); + if (x0>x1) { const int tmp=x0;x0=x1;x1=tmp; } for (int x=x0; x<=x1; ++x) pset(x, y); } @@ -442,7 +441,7 @@ void hline(int x0, int y, int x1, uint8_t color) { } void vline(int x, int y0, int y1) { - if (y0>y1) swap(y0, y1); + if (y0>y1) { const int tmp=y0;y0=y1;y1=tmp; } for (int y=y0; y<=y1; ++y) pset(x, y); } @@ -741,7 +740,7 @@ void tline(int x0, int y0, int x1, int y1, float mx, float my, float mdx, float } void thline(int x0, int y, int x1, float mx, float my, float mdx, float mdy) { - if (x0>x1) swap(x0, x1); + if (x0>x1) { const int tmp=x0;x0=x1;x1=tmp; } for (int x=x0; x<=x1; ++x) { pset(x, y, sget(mx*8, my*8)); mx += mdx; @@ -750,7 +749,7 @@ void thline(int x0, int y, int x1, float mx, float my, float mdx, float mdy) { } void tvline(int x, int y0, int y1, float mx, float my, float mdx, float mdy) { - if (y0>y1) swap(y0, y1); + if (y0>y1) { const int tmp=y0;y0=y1;y1=tmp; } for (int y=y0; y<=y1; ++y) { pset(x, y, sget(mx*8, my*8)); mx += mdx; @@ -887,7 +886,7 @@ float min(float x, float y) { int utfstrlen(const char *str) { const int size_in_bytes = SDL_strlen(str); int size_in_utfchars = 0; - for (int i=0;i