Re: [PATCH 1/7] dm: Replace __HIGH() and __LOW() macros

Adrian Bunk (bunk@fs.tum.de)
Wed, 18 Jun 2003 01:10:01 +0200


On Mon, Jun 09, 2003 at 03:34:40PM +0100, Joe Thornber wrote:
> Replace __HIGH() and __LOW() with max() and min_not_zero().
> --- diff/drivers/md/dm-table.c 2003-05-21 11:50:15.000000000 +0100
> +++ source/drivers/md/dm-table.c 2003-06-09 15:04:57.000000000 +0100
> @@ -78,22 +78,33 @@
> return result;
> }
>
> -#define __HIGH(l, r) if (*(l) < (r)) *(l) = (r)
> -#define __LOW(l, r) if (*(l) == 0 || *(l) > (r)) *(l) = (r)
> +/*
> + * Returns the minimum that is _not_ zero, unless both are zero.
> + */
> +#define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
>...

Are there potential other users of min_not_zero?
If yes, shouldn't it go into kernel.h?

cu
Adrian

-- 

"Is there not promise of rain?" Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. "Only a promise," Lao Er said. Pearl S. Buck - Dragon Seed

- 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/