lkml.org 
[lkml]   [2004]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: MSEC_TO_JIFFIES is messed up...
From
Date
  > Being curious, I tried that and got the same results.  But this:
>
> int f(unsigned int x)
> {
> return x * (1000 / 1000);
> }
>
> creates this:
> f:
> pushl %ebp
> movl %esp, %ebp
> movl 8(%ebp), %eax
> leave
> ret

Of course the compiler can optimize (1000 / 1000) into 1 at compile
time. However, the original code was doing something like

x * HZ / 1000

if you change that to

x * (HZ / 1000)

then obviously that breaks if HZ is not a multiple of 1000.

- Roland
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.040 / U:1.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site