Opened 18 years ago
Closed 17 years ago
#289 closed Bugs (None)
xtime_cmp: use comparison not subtraction
Reported by: | phhodges | Owned by: | glassfordm |
---|---|---|---|
Milestone: | Component: | timer | |
Version: | None | Severity: | |
Keywords: | Cc: |
Description
Subtraction of integral types is prone to arithmetic overflow. It is not well-behaved for implementing comparison unless we first cast both operands to a wider integral type or assert that they fall in a narrower range. Choose comparison order to slightly favour future timeouts, or imminent timeouts in the same second? Patch provided "as is" without express or implied warranty. It may contain any number of intended and unintended flaws.
Note:
See TracTickets
for help on using tickets.