mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: Andrew Morton <akpm@zip.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: min_not_zero()
Date: Sun, 28 Sep 2003 02:56:52 +0100	[thread overview]
Message-ID: <20030928015652.GY24824@parcelfarce.linux.theplanet.co.uk> (raw)


Here's a thought ...

#define min_not_zero(l, r) \
	min((unsigned long)(l - 1), (unsigned long)(r - 1)) + 1

Seems to me that'll always give the right answer ... 0 if both 0,
otherwise the lower of the two.  And it's kind of an awkward name.
How about making it *really* specific to request_queue, putting it in
blkdev.h and calling it request_sector_min() like so:

#define request_sector_min(a, b) \
	min((a)->max_sectors - 1, (b)->max_sectors - 1) + 1

(no cast needed cos they're already unsigned.  um, unless I've misremembered
how C constants work again... should they be 1U?)

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

                 reply	other threads:[~2003-09-28  1:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030928015652.GY24824@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®