diff options
author | Jamey Sharp <jamey@minilop.net> | 2009-10-28 17:48:18 -0700 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-11-03 13:25:44 +1000 |
commit | 6ca6283bce5e0d272ec2b416f1ab230ec8719fdd (patch) | |
tree | 2521f4387872db43c958afb56f5382ca942c8a6f | |
parent | ebbac195508c9941a9349f48867aff1b0dd827b1 (diff) |
Don't cast double to int: use default conversions or explicitly round.
GCC warns about casting a double return value to int.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 239435875d6a92ed31731b500a992a3af0943594)
-rw-r--r-- | hw/xfree86/i2c/fi1236.c | 10 | ||||
-rw-r--r-- | hw/xfree86/parser/Flags.c | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/hw/xfree86/i2c/fi1236.c b/hw/xfree86/i2c/fi1236.c index 110563ed9..7c39edbee 100644 --- a/hw/xfree86/i2c/fi1236.c +++ b/hw/xfree86/i2c/fi1236.c @@ -225,7 +225,7 @@ m->f_ifbw=f_ifbw; m->f_step=f_step; m->f_lo1=f_rf+f_if1; -m->LO1I=(int)floor((m->f_lo1/f_ref)+0.5); +m->LO1I=lrint(m->f_lo1/f_ref); m->f_lo1=f_ref*m->LO1I; m->f_lo2=m->f_lo1-f_rf-f_if2; @@ -258,10 +258,10 @@ if(m->f_lo1<1890.0)m->SEL=1; m->SEL=0; /* calculate the rest of the registers */ -m->LO2I=(int)floor(m->f_lo2/f_ref); -m->STEP=(int)floor(3780.0*f_step/f_ref); -m->NUM=(int)floor(3780.0*(m->f_lo2/f_ref-m->LO2I)); -m->NUM=m->STEP*(int)floor((1.0*m->NUM)/(1.0*m->STEP)+0.5); +m->LO2I=floor(m->f_lo2/f_ref); +m->STEP=floor(3780.0*f_step/f_ref); +m->NUM=floor(3780.0*(m->f_lo2/f_ref-m->LO2I)); +m->NUM=m->STEP*lrint((1.0*m->NUM)/(1.0*m->STEP)); } static int MT2032_wait_for_lock(FI1236Ptr f) diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c index 6865d3592..699f15ceb 100644 --- a/hw/xfree86/parser/Flags.c +++ b/hw/xfree86/parser/Flags.c @@ -434,7 +434,7 @@ xf86uLongToString(unsigned long i) char *s; int l; - l = (int)(ceil(log10((double)i) + 2.5)); + l = ceil(log10((double)i) + 2.5); s = malloc(l); if (!s) return NULL; |