Commit d02235c
timeutil: timespec: mitigate warnings when -Wtype-limits is used
Previously, warnings could be promoted to errors in timeutil.h. Those
warnings were of the form below.
warning: comparison is always true due to limited range of data type
warning: comparison is always false due to limited range of data type
Specifically, in the speed-optimized version of timespec_normalize() and
in the macro SYS_TICKS_TO_NSECS().
The speed-optimized version of timespec_normalize(), which used the
__builtin_add_overflow() function, was mainly intended to be branchless.
However, many targets generate branching instructions regardless.
The speed optimized version is less valuable in that case, so remove it.
Additionally, SYS_TICKS_TO_NSECS() does not generate the above warnings
when k_ticks_to_ns_floor64() is used instead of k_ticks_to_ns_floor32(),
so use the former.
Signed-off-by: Chris Friedt <[email protected]>1 parent ed6b4a2 commit d02235c
1 file changed
+1
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | 422 | | |
453 | 423 | | |
454 | 424 | | |
| |||
489 | 459 | | |
490 | 460 | | |
491 | 461 | | |
492 | | - | |
493 | 462 | | |
494 | 463 | | |
495 | 464 | | |
| |||
0 commit comments