Erik Faye-Lund wrote: > --- a/git-compat-util.h > +++ b/git-compat-util.h > @@ -28,6 +28,15 @@ > #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) > #define bitsizeof(x) (CHAR_BIT * sizeof(x)) > > +/* > + * Signed integer overflow is undefined in C and some compilers take > + * advantage of this when optimizing [...] > + */ > +#define signed_add_overflows(a, b) \ > + ((b) > ((INTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a))) - (a))) Clever. I like it. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html