SHARE
TWEET

Untitled

a guest Sep 23rd, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. uint16_t satsum(uint16_t x, uint16_t y) {
  5. if (x < y) {
  6. uint16_t t = x;
  7. x = y;
  8. y = t;
  9. }
  10.  
  11. uint16_t res = x + y;
  12.  
  13. if (res < x) {
  14. return (x - res - 1 + y );
  15. }
  16.  
  17. return res;
  18. }
  19.  
  20. int main() {
  21. uint16_t r = satsum((uint16_t )65515,(uint16_t )10);
  22. printf("%i", (int)r);
  23. return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top