fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. inline bool timer_timestamp_less_1(uint32_t t1,uint32_t t2){
  5. return (t1-t2)>(1U<<31);
  6. }
  7.  
  8. inline bool timer_timestamp_less_2(uint32_t t1,uint32_t t2){
  9. return (t1 < t2);
  10. }
  11.  
  12. int main(){
  13. // Equivalent
  14. cout << !timer_timestamp_less_1(1, 2) << endl; // 1
  15. cout << !timer_timestamp_less_2(1, 2) << endl; // 1
  16. // Not Equivalent
  17. cout << !timer_timestamp_less_1(-1, 2) << endl; // 0
  18. cout << !timer_timestamp_less_2(-1, 2) << endl; // 1
  19. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
0
0
0
1