Re: [PATCH] Minor fixes to generic do_div

From: Andrew Morton
Date: Fri Oct 20 2006 - 01:00:24 EST


On Thu, 19 Oct 2006 21:34:00 -0600
Matthew Wilcox <matthew@xxxxxx> wrote:

> +/* The unnecessary pointer compare is there
> + * to check for type safety (n must be 64bit)
> + */
> +# define do_div(n,base) ({ \
> + uint32_t __base = (base); \
> + uint32_t __rem; \
> + (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
> + __rem = ((uint64_t)(n)) % __base; \
> + (n) = ((uint64_t)(n)) / __base; \
> + __rem; \
> })

Can we use typecheck(), from include/linux/kernel.h?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/