Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2019-03-07 at 08:18 +-0100, Rasmus Villemoes wrote:
+AD4 On 07/03/2019 03.14, Bart Van Assche wrote:
+AD4 +AD4 On 3/6/19 5:24 PM, Jason Gunthorpe wrote:
+AD4 +AD4 +AD4 +AD4 
+AD4 +AD4 +AD4 +AD4 diff --git a/include/linux/overflow.h b/include/linux/overflow.h
+AD4 +AD4 +AD4 +AD4 index 40b48e2133cb..8afe0c0ada6f 100644
+AD4 +AD4 +AD4 +AD4 +-+-+- b/include/linux/overflow.h
+AD4 +AD4 +AD4 +AD4 +AEAAQA -202,6 +-202,24 +AEAAQA
+AD4 +AD4 +AD4 +AD4     +ACM-endif /+ACo COMPILER+AF8-HAS+AF8-GENERIC+AF8-BUILTIN+AF8-OVERFLOW +ACo-/
+AD4 +AD4 +AD4 +AD4   +-/+ACo
+AD4 +AD4 +AD4 +AD4 +- +ACo Evaluate a +AD4APQ 0 without triggering a compiler warning if the type
+AD4 +AD4 +AD4 +AD4 of a
+AD4 +AD4 +AD4 +AD4 +- +ACo is an unsigned type.
+AD4 +AD4 +AD4 +AD4 +- +ACo-/
+AD4 +AD4 +AD4 +AD4 +-+ACM-define is+AF8-positive(a) (+AHs                    +AFw
+AD4 
+AD4 is+AF8-non+AF8-negative, please+ACE positive means +AD4 0. And perhaps it's better to
+AD4 move these utility macros closer to the top of the file, together with
+AD4 the other type/range helpers.

Hi Rasmus,

Thank you for the feedback. But according to what I found online opinions
about whether or not zero is a positive number seem to vary. From
https://en.wikipedia.org/wiki/Sign+AF8(mathematics):

Terminology for signs

When 0 is said to be neither positive nor negative, the following phrases
may be used to refer to the sign of a number:
+ACo A number is positive if it is greater than zero.
+ACo A number is negative if it is less than zero.
+ACo A number is non-negative if it is greater than or equal to zero.
+ACo A number is non-positive if it is less than or equal to zero.

When 0 is said to be both positive and negative, modified phrases are used
to refer to the sign of a number:
+ACo A number is strictly positive if it is greater than zero.
+ACo A number is strictly negative if it is less than zero.
+ACo A number is positive if it is greater than or equal to zero.
+ACo A number is negative if it is less than or equal to zero.

Bart.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux