Use own private function instead of roundf()

merge-requests/1/head
Ilia Sotnikov 2009-10-03 13:25:05 +03:00
rodzic 8c4f699134
commit 798c96412a
2 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -1,3 +1,6 @@
2009-10-03 Ilia Sotnikov <hostcc@gmail.com>
* backend/epjitsu.c: use own private function instead of roundf()
2009-10-02 Stéphane Voltz <stef.dev at free.fr>
* backend/genesys_gl646.c: honor GENESYS_NO_CALIBRATION device
flag when setting registers for final scan

Wyświetl plik

@ -2902,6 +2902,13 @@ finecal_get_line(struct scanner *s, struct image *img)
return ret;
}
/* roundf() is c99, so we provide our own, though this version wont return -0 */
static float
round2(float x)
{
return (float)(x >= 0.0) ? (int)(x+0.5) : (int)(x-0.5);
}
static SANE_Status
finecal(struct scanner *s)
{
@ -3017,7 +3024,7 @@ finecal(struct scanner *s)
gain_slope[idx] *= 0.75;
last_error[idx] = pixerror;
/* set the new gain */
newgain = oldgain + (int) roundf(pixerror * gain_slope[idx]);
newgain = oldgain + (int) round2(pixerror * gain_slope[idx]);
if (newgain < 0)
{
low_pegs++;