On 07/27/2011 10:55 PM, Chad Versace wrote: > The function used a variable named 'score', which was an outright lie. > A signature matches or it doesn't; there is no fuzzy scoring. > > CC: Ian Romanick <ian.d.roman...@intel.com> > CC: Kenneth Graunke <kenn...@whitecape.org> > Signed-off-by: Chad Versace <c...@chad-versace.us> > --- > src/glsl/ir_function.cpp | 19 ++++++++++++------- > 1 files changed, 12 insertions(+), 7 deletions(-) > > diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp > index e25b094..5a2c9bb 100644 > --- a/src/glsl/ir_function.cpp > +++ b/src/glsl/ir_function.cpp > @@ -134,18 +134,23 @@ ir_function::matching_signature(const exec_list > *actual_parameters) > ir_function_signature *const sig = > (ir_function_signature *) iter.get(); > > - const int score = parameter_lists_match(& sig->parameters, > - actual_parameters); > - > - /* If we found an exact match, simply return it */ > - if (score == 0) > + switch (parameter_lists_match(& sig->parameters, actual_parameters)) { > + case 0: > + /* Exact match. */ > return sig; > - > - if (score > 0) { > + case 1:
I like the switch statement, but it'd be even clearer to use an enum. > + /* Inexact match that requires implicit conversion. */ > if (match == NULL) > match = sig; > else > multiple_inexact_matches = true; > + continue; > + case -1: > + /* Not a match. */ > + continue; > + default: > + assert(false); > + return NULL; > } > } _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev