Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix timespec >= comparison operator.

  • Loading branch information...
commit 14ed61be76ab1e0da1959636a5086f101b1db120 1 parent 40b2140
@dtzWill authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/plugin/sdl/sdlcore_p.hpp
View
2  src/plugin/sdl/sdlcore_p.hpp
@@ -39,7 +39,7 @@ inline bool operator>(const timespec &a, const timespec &b) {
return (b < a);
}
inline bool operator>=(const timespec &a, const timespec &b) {
- return (b >= a);
+ return (b <= a);
}
namespace SDL {

2 comments on commit 14ed61b

@RyanHope

can you comment on why this was wrong

@dtzWill
Owner

Sure, should have done so originally, sorry!

As-is in master, it defines "a >= b" as "b >= a" which is both logically wrong and dangerously recursive.

The fix defines "a >= b" as "b <=a ", which is sound by itself, and re-uses the implementation of <=, as operator> uses the definition of <.

Please sign in to comment.
Something went wrong with that request. Please try again.