This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH Committed]: scratch_buffer: Suppress truncation warning on 32-bit


Florian Weimer wrote:
  	      && unchanged_array_size (&buf, 1ULL << 16, 0)
  	      && unchanged_array_size (&buf, 0, 1ULL << 16)
-	      && unchanged_array_size (&buf, 1ULL << 32, 0)
-	      && unchanged_array_size (&buf, 0, 1ULL << 32)))
+	      && unchanged_array_size (&buf, (size_t) (1ULL << 32), 0)
+	      && unchanged_array_size (&buf, 0, (size_t) (1ULL << 32))))

A small point: it's better to avoid suffixes like "ULL" when it's easy, which is the case here. The above can be written as:

              && unchanged_array_size (&buf, 1 << 16, 0)
              && unchanged_array_size (&buf, 0, 1 << 16)
              && unchanged_array_size (&buf, (size_t) 1 << 31 << 1, 0)
              && unchanged_array_size (&buf, 0, (size_t) 1 << 31 << 1)))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]