diff options
Diffstat (limited to 'lib/intprops.h')
-rw-r--r-- | lib/intprops.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/intprops.h b/lib/intprops.h index 8fff86d437..ecafaf70e1 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -272,9 +272,10 @@ Example usage, assuming A and B are long int: - long int result = INT_MULTIPLY_WRAPV (a, b); - printf ("result is %ld (%s)\n", result, - INT_MULTIPLY_OVERFLOW (a, b) ? "after overflow" : "no overflow"); + if (INT_MULTIPLY_OVERFLOW (a, b)) + printf ("result would overflow\n"); + else + printf ("result is %ld (no overflow)\n", a * b); Example usage with WRAPV flavor: |