All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sverre Rabbelier <srabbelier@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, Erik Faye-Lund <kusmabite@gmail.com>,
	Jeff King <peff@peff.net>, Nicolas Pitre <nico@fluxnic.net>,
	Pierre Habouzit <madcoder@debian.org>,
	Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Subject: Re: [PATCH] compat: helper for detecting unsigned overflow
Date: Thu, 10 Feb 2011 13:11:17 +0100	[thread overview]
Message-ID: <AANLkTinqkSxj0C+GyMVR4a7d=yy_mh+oDuar0moZjZ8_@mail.gmail.com> (raw)
In-Reply-To: <20110210093536.GB365@elie>

Heya,

On Thu, Feb 10, 2011 at 10:35, Jonathan Nieder <jrnieder@gmail.com> wrote:
>        unsigned_add_overflows(a, b)

> Define such a macro, expanding roughly to ((a) < UINT_MAX - (b)).
> Because the expansion uses each argument only once outside of sizeof()
> expressions, it is safe to use with arguments that have side effects.

> +#define unsigned_add_overflows(a, b) \
> +    ((b) > maximum_unsigned_value_of_type(a) - (a))

I'm confused, you say you won't use it twice, and then you do use it twice?

-- 
Cheers,

Sverre Rabbelier

  reply	other threads:[~2011-02-10 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05  7:24 [PATCH v4] do not depend on signed integer overflow Erik Faye-Lund
2010-10-05 13:28 ` Nicolas Pitre
2011-02-10  9:35 ` [PATCH] compat: helper for detecting unsigned overflow Jonathan Nieder
2011-02-10 12:11   ` Sverre Rabbelier [this message]
2011-02-10 13:23     ` Joshua Juran

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='AANLkTinqkSxj0C+GyMVR4a7d=yy_mh+oDuar0moZjZ8_@mail.gmail.com' \
    --to=srabbelier@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=jrnieder@gmail.com \
    --cc=kusmabite@gmail.com \
    --cc=madcoder@debian.org \
    --cc=nico@fluxnic.net \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.