From 697c5987dc157c4d6e6b18c2606e17334a22905b Mon Sep 17 00:00:00 2001 From: cancel Date: Tue, 22 Jan 2019 08:23:39 +0900 Subject: [PATCH] Remove 'usz_clamp()', no longer needed --- sim.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sim.c b/sim.c index 3926841..b7c6b57 100644 --- a/sim.c +++ b/sim.c @@ -90,6 +90,7 @@ ORCA_PURE static bool oper_has_neighboring_bang(Glyph const* gbuf, Usz h, Usz w, return false; } +// Returns UINT8_MAX if not a valid note. static U8 midi_note_number_of(Glyph g) { switch (g) { case 'C': @@ -155,15 +156,6 @@ static void oper_poke_and_stun(Glyph* restrict gbuffer, Mark* restrict mbuffer, mbuffer[offs] |= Mark_flag_sleep; } -ORCA_FORCE_STATIC_INLINE -Usz usz_clamp(Usz val, Usz min, Usz max) { - if (val < min) - return min; - if (val > max) - return max; - return val; -} - #define OPER_FUNCTION_ATTRIBS ORCA_FORCE_NO_INLINE static void #define BEGIN_OPERATOR(_oper_name) \ @@ -364,7 +356,7 @@ BEGIN_OPERATOR(midi) (Oevent_midi*)oevent_list_alloc_item(extra_params->oevent_list); oe->oevent_type = (U8)Oevent_type_midi; oe->channel = (U8)channel_num; - oe->octave = (U8)usz_clamp(octave_num, 1, 9); + oe->octave = octave_num; oe->note = note_num; oe->velocity = midi_velocity_of(velocity_g); oe->bar_divisor = (U8)(index_of(length_g) + 1);