Messages in this thread | | | Date | Thu, 30 Aug 2001 21:51:52 +0200 | From | David Weinehall <> | Subject | Re: [IDEA+RFC] Possible solution for min()/max() war |
| |
On Thu, Aug 30, 2001 at 06:38:40PM +0200, Peter T. Breuer wrote: > "Linus Torvalds wrote:" > > What if the "int" happens to be negative? > > if sizeof(typeof(a)) != sizeof(typeof(b)) > BUG() // sizes differ > const (typeof(a)) _a = ~(typeof(a))0 > const (typeof(b)) _b = ~(typeof(b))0 > if _a < 0 && _b > 0 || _a > 0 && b < 0 > BUG() // one signed, the other unsigned > standard_max(a,b)
<disgusting vomit-sound>Do you really want code like that in the kernel (yes, I know that there are code that can compete with it in ugliness</disgusting vomit-sound>
/David Weinehall _ _ // David Weinehall <tao@acc.umu.se> /> Northern lights wander \\ // Project MCA Linux hacker // Dance across the winter sky // \> http://www.acc.umu.se/~tao/ </ Full colour fire </ - 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/
| |