| To: | Andrew Morton <akpm@xxxxxxxx> |
|---|---|
| Subject: | Re: MSEC_TO_JIFFIES is messed up... |
| From: | William Lee Irwin III <wli@xxxxxxxxxxxxxx> |
| Date: | Wed, 12 May 2004 13:38:29 -0700 |
| Cc: | Ingo Molnar <mingo@xxxxxxx>, davidel@xxxxxxxxxxxxxxx, jgarzik@xxxxxxxxx, greg@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| In-reply-to: | <20040512132050.6eae6905.akpm@osdl.org> |
| Mail-followup-to: | William Lee Irwin III <wli@xxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, Ingo Molnar <mingo@xxxxxxx>, davidel@xxxxxxxxxxxxxxx, jgarzik@xxxxxxxxx, greg@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| References: | <20040512020700.6f6aa61f.akpm@osdl.org> <20040512181903.GG13421@kroah.com> <40A26FFA.4030701@pobox.com> <20040512193349.GA14936@elte.hu> <Pine.LNX.4.58.0405121247011.11950@bigblue.dev.mdolabs.com> <20040512200305.GA16078@elte.hu> <20040512132050.6eae6905.akpm@osdl.org> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | Mutt/1.5.5.1+cvs20040105i |
On Wed, May 12, 2004 at 01:20:50PM -0700, Andrew Morton wrote: > How about we do: > #if HZ=1000 > #define MSEC_TO_JIFFIES(msec) (msec) > #define JIFFIES_TO_MESC(jiffies) (jiffies) > #elif HZ=100 > #define MSEC_TO_JIFFIES(msec) (msec * 10) > #define JIFFIES_TO_MESC(jiffies) (jiffies / 10) > #else > #define MSEC_TO_JIFFIES(msec) ((HZ * (msec) + 999) / 1000) > #define JIFFIES_TO_MSEC(jiffies) ... > #endif > in some kernel-wide header then kill off all the private implementations? How about this? #if HZ <= 1000 && !(1000 % HZ) #define MSEC_TO_JIFFIES(m) ((1000/HZ)*(m)) #define JIFFIES_TO_MSEC(j) ((j)/(1000/HZ)) #elif HZ > 1000 && !(HZ % 1000) #define MSEC_TO_JIFFIES(m) ((m)/(HZ/1000)) #define JIFFIES_TO_MSEC(j) ((HZ/1000)*(j)) #else #define MSEC_TO_JIFFIES(m) ((HZ*(m) + 999)/1000) #define JIFFIES_TO_MSEC(j) ((1000*(j) + HZ - 1)/HZ) #endif -- wli |
| Previous by Date: | Re: MSEC_TO_JIFFIES is messed up..., Andrew Morton |
|---|---|
| Next by Date: | RE: MSEC_TO_JIFFIES is messed up..., Jan Olderdissen |
| Previous by Thread: | Re: MSEC_TO_JIFFIES is messed up..., Greg KH |
| Next by Thread: | Re: MSEC_TO_JIFFIES is messed up..., Andrew Morton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |