uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit cd0ca2eb17f9bb473ea138adc839d7c874c27f44
parent cf84a5d66187dc620b25de35e62a77c506c15424
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Thu, 20 Jan 2022 01:24:13 +0000

Move clamp() to screen.c.

Diffstat:
Msrc/devices/screen.c | 6++++++
Msrc/devices/screen.h | 1+
Msrc/uxnemu.c | 6------
3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/devices/screen.c b/src/devices/screen.c @@ -108,6 +108,12 @@ screen_redraw(UxnScreen *p, Uint32 *pixels) p->fg.changed = p->bg.changed = 0; } +int +clamp(int val, int min, int max) +{ + return (val >= min) ? (val <= max) ? val : max : min; +} + /* IO */ Uint8 diff --git a/src/devices/screen.h b/src/devices/screen.h @@ -34,3 +34,4 @@ void screen_redraw(UxnScreen *p, Uint32 *pixels); Uint8 screen_dei(Device *d, Uint8 port); void screen_deo(Device *d, Uint8 port); +int clamp(int val, int min, int max); diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -47,12 +47,6 @@ static Uint8 zoom = 1; static Uint32 stdin_event, audio0_event; static int -clamp(int val, int min, int max) -{ - return (val >= min) ? (val <= max) ? val : max : min; -} - -static int error(char *msg, const char *err) { fprintf(stderr, "%s: %s\n", msg, err);