Messages in this thread | | | Date | Wed, 12 May 2004 13:38:29 -0700 | From | William Lee Irwin III <> | Subject | Re: MSEC_TO_JIFFIES is messed up... |
| |
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 - 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/
| |