Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=7f0647ade3f8f7c6cc1db2a5cf40e63f2df93de3
commit 7f0647ade3f8f7c6cc1db2a5cf40e63f2df93de3 Author: James Buren <[email protected]> Date: Fri Sep 7 02:55:11 2012 -0500 implement inline versions of min/max that work on arrays diff --git a/src/local.h b/src/local.h index 8e5cc75..ddff5a9 100644 --- a/src/local.h +++ b/src/local.h @@ -60,6 +60,24 @@ extern bool get_button_screen_size(const char *text,int *width,int *height); extern bool get_label_screen_size(const char *text,int *width,int *height); static inline long min(long a,long b) { return (a < b) ? a : b; } static inline long max(long a,long b) { return (a > b) ? a : b; } +static inline long minv(long *v,size_t size) +{ + long i = 0; + + for( size_t n = 0 ; n < size ; ++n ) + i = min(i,v[n]); + + return i; +} +static inline long maxv(long *v,size_t size) +{ + long i = 0; + + for( size_t n = 0 ; n < size ; ++n ) + i = max(i,v[n]); + + return i; +} extern int ui_main(int argc,char **argv); extern void ui_dialog_text(const char *title,const char *text); extern bool ui_dialog_yesno(const char *title,const char *text,bool defaultno); _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
