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] | |
Hi Paul,
> 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.
Ok.
>
> Doesn't glibc prefer 'long int' to 'long'?
I've used the type from struct timespec definition (long tv_nsec;)
I can change it to long int if preferred.
>
> The function body should simply be 'return __glibc_likely (0 <= ns &&
> ns < 1000000000);' (for range checks I prefer textual order to
> reflect numeric order).
Then the function shall be rewritten to:
static inline bool
valid_nanoseconds (long ns)
{
return __glibc_likely (0 <= ns && ns < 1000000000);
}
The question is if we do prefer ns < 1000000000 or ns <= 999999999 ?
The 1000000000 is used in the hardcoded conditions, which this function
replaces, hence maybe we shall keep the 1000000000?
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Attachment:
pgpnlwerW5BEF.pgp
Description: OpenPGP digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |