Changeset 4716

Show
Ignore:
Timestamp:
08/26/07 22:35:26 (1 year ago)
Author:
khali
Message:

print_temp_info is only ever called with precision values of 1, so we
can hard-code this precision for improved performance.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/branches/lm-sensors-3.0.0/prog/sensors/chips.c

    r4715 r4716  
    4141#define HYSTONLY 5 
    4242 
    43 /* minmax = 0 for limit/hysteresis, 1 for max/min, 2 for max only; 
    44    curprec and limitprec are # of digits after decimal point 
    45    for the current temp and the limits 
    46    note: symbolic constants defined in chips.h */ 
     43/* symbolic constants for minmax defined above */ 
    4744static void print_temp_info(float n_cur, float n_over, float n_hyst, 
    48                             int minmax, int curprec, int limitprec
     45                            int minmax
    4946{ 
    5047        /* note: deg_ctof() will preserve HUGEVAL */ 
     
    5552        } 
    5653 
    57         /* use %* to pass precision as an argument */ 
    5854        if (n_cur != HUGE_VAL) 
    59                 printf("%+6.*f%s  ", curprec, n_cur, degstr); 
     55                printf("%+6.1f%s  ", n_cur, degstr); 
    6056        else 
    6157                printf("   FAULT  "); 
    6258 
    6359        if (minmax == MINMAX) 
    64                 printf("(low  = %+5.*f%s, high = %+5.*f%s)  ", 
    65                        limitprec, n_hyst, degstr, 
    66                        limitprec, n_over, degstr); 
     60                printf("(low  = %+5.1f%s, high = %+5.1f%s)  ", 
     61                       n_hyst, degstr, 
     62                       n_over, degstr); 
    6763        else if (minmax == MAXONLY) 
    68                 printf("(high = %+5.*f%s)                  ", 
    69                        limitprec, n_over, degstr); 
     64                printf("(high = %+5.1f%s)                  ", 
     65                       n_over, degstr); 
    7066        else if (minmax == CRIT) 
    71                 printf("(high = %+5.*f%s, crit = %+5.*f%s)  ", 
    72                        limitprec, n_over, degstr, 
    73                        limitprec, n_hyst, degstr); 
     67                printf("(high = %+5.1f%s, crit = %+5.1f%s)  ", 
     68                       n_over, degstr, 
     69                       n_hyst, degstr); 
    7470        else if (minmax == HYST) 
    75                 printf("(high = %+5.*f%s, hyst = %+5.*f%s)  ", 
    76                        limitprec, n_over, degstr, 
    77                        limitprec, n_hyst, degstr); 
     71                printf("(high = %+5.1f%s, hyst = %+5.1f%s)  ", 
     72                       n_over, degstr, 
     73                       n_hyst, degstr); 
    7874        else if (minmax == HYSTONLY) 
    79                 printf("(hyst = %+5.*f%s)                  ", 
    80                        limitprec, n_over, degstr); 
     75                printf("(hyst = %+5.1f%s)                  ", 
     76                       n_over, degstr); 
    8177        else if (minmax != SINGLE) 
    8278                printf("Unknown temperature mode!"); 
     
    242238        free(label); 
    243239 
    244         print_temp_info(val, max, min, type, 1, 1); 
     240        print_temp_info(val, max, min, type); 
    245241 
    246242        /* ALARM features */