Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- uint16_t satsum(uint16_t x, uint16_t y) {
- if (x < y) {
- uint16_t t = x;
- x = y;
- y = t;
- }
- uint16_t res = x + y;
- if (res < x) {
- return (x - res - 1 + y );
- }
- return res;
- }
- int main() {
- uint16_t r = satsum((uint16_t )65515,(uint16_t )10);
- printf("%i", (int)r);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement