Messages in this thread | | | From | Daniel Phillips <> | Subject | Re: [IDEA+RFC] Possible solution for min()/max() war | Date | Wed, 29 Aug 2001 02:33:52 +0200 |
| |
On August 28, 2001 05:14 pm, Linus Torvalds wrote: > I'll show you a real example from drivers/acorn/scsi/acornscsi.c: > > min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2); > > this_residual is "int", and "DMAC_BUFFER_SIZE" is just a #define for > an integer constant. So the above is actually a signed comparison, and > I'll bet you that was not what the author intended. > > Now, this_residual is hopefully never negative, so it doesn't matter.
min(host->scsi.SCp.this_residual, (unsigned) DMAC_BUFFER_SIZE / 2);
-- Daniel - 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/
| |