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] time: Introduce function to check correctness of nanoseconds value


On 10/24/19 2:14 PM, Lukasz Majewski wrote:
+static inline bool valid_nanoseconds (long ns)
+{
+  if (__glibc_likely (ns >= 0 && ns <= 999999999))
+    return true;
+
+  return false;
+}

The function name should be at the start of the line.

Doesn't glibc prefer 'long int' to 'long'?

The function body should simply be 'return __glibc_likely (0 <= ns && ns < 1000000000);' (for range checks I prefer textual order to reflect numeric order).


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