summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2009-10-28 17:48:18 -0700
committerKeith Packard <keithp@keithp.com>2009-10-28 18:56:42 -0700
commit239435875d6a92ed31731b500a992a3af0943594 (patch)
tree1b198a2262ffc6d9b4d9df172ee24978eef90176
parente8c48fd8f7aab54327b0091cd17c60235ae27168 (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>
-rw-r--r--hw/xfree86/i2c/fi1236.c10
-rw-r--r--hw/xfree86/parser/Flags.c2
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;