| ... | @@ -415,15 +415,15 @@ static inline long long zig_subw_longlong(long long lhs, long long rhs, long lon | ... | @@ -415,15 +415,15 @@ static inline long long zig_subw_longlong(long long lhs, long long rhs, long lon |
| 415 | static inline bool zig_addo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, int8_t max) { | 415 | static inline bool zig_addo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, int8_t max) { |
| 416 | #if defined(__GNUC__) && INT8_MAX == INT_MAX | 416 | #if defined(__GNUC__) && INT8_MAX == INT_MAX |
| 417 | if (min == INT8_MIN && max == INT8_MAX) { | 417 | if (min == INT8_MIN && max == INT8_MAX) { |
| 418 | return __builtin_sadd_overflow(lhs, rhs, res); | 418 | return __builtin_sadd_overflow(lhs, rhs, (int*)res); |
| 419 | } | 419 | } |
| 420 | #elif defined(__GNUC__) && INT8_MAX == LONG_MAX | 420 | #elif defined(__GNUC__) && INT8_MAX == LONG_MAX |
| 421 | if (min == INT8_MIN && max == INT8_MAX) { | 421 | if (min == INT8_MIN && max == INT8_MAX) { |
| 422 | return __builtin_saddl_overflow(lhs, rhs, res); | 422 | return __builtin_saddl_overflow(lhs, rhs, (long*)res); |
| 423 | } | 423 | } |
| 424 | #elif defined(__GNUC__) && INT8_MAX == LLONG_MAX | 424 | #elif defined(__GNUC__) && INT8_MAX == LLONG_MAX |
| 425 | if (min == INT8_MIN && max == INT8_MAX) { | 425 | if (min == INT8_MIN && max == INT8_MAX) { |
| 426 | return __builtin_saddll_overflow(lhs, rhs, res); | 426 | return __builtin_saddll_overflow(lhs, rhs, (long long*)res); |
| 427 | } | 427 | } |
| 428 | #endif | 428 | #endif |
| 429 | int16_t big_result = (int16_t)lhs + (int16_t)rhs; | 429 | int16_t big_result = (int16_t)lhs + (int16_t)rhs; |
| ... | @@ -442,15 +442,15 @@ static inline bool zig_addo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, | ... | @@ -442,15 +442,15 @@ static inline bool zig_addo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, |
| 442 | static inline bool zig_addo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t min, int16_t max) { | 442 | static inline bool zig_addo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t min, int16_t max) { |
| 443 | #if defined(__GNUC__) && INT16_MAX == INT_MAX | 443 | #if defined(__GNUC__) && INT16_MAX == INT_MAX |
| 444 | if (min == INT16_MIN && max == INT16_MAX) { | 444 | if (min == INT16_MIN && max == INT16_MAX) { |
| 445 | return __builtin_sadd_overflow(lhs, rhs, res); | 445 | return __builtin_sadd_overflow(lhs, rhs, (int*)res); |
| 446 | } | 446 | } |
| 447 | #elif defined(__GNUC__) && INT16_MAX == LONG_MAX | 447 | #elif defined(__GNUC__) && INT16_MAX == LONG_MAX |
| 448 | if (min == INT16_MIN && max == INT16_MAX) { | 448 | if (min == INT16_MIN && max == INT16_MAX) { |
| 449 | return __builtin_saddl_overflow(lhs, rhs, res); | 449 | return __builtin_saddl_overflow(lhs, rhs, (long*)res); |
| 450 | } | 450 | } |
| 451 | #elif defined(__GNUC__) && INT16_MAX == LLONG_MAX | 451 | #elif defined(__GNUC__) && INT16_MAX == LLONG_MAX |
| 452 | if (min == INT16_MIN && max == INT16_MAX) { | 452 | if (min == INT16_MIN && max == INT16_MAX) { |
| 453 | return __builtin_saddll_overflow(lhs, rhs, res); | 453 | return __builtin_saddll_overflow(lhs, rhs, (long long*)res); |
| 454 | } | 454 | } |
| 455 | #endif | 455 | #endif |
| 456 | int32_t big_result = (int32_t)lhs + (int32_t)rhs; | 456 | int32_t big_result = (int32_t)lhs + (int32_t)rhs; |
| ... | @@ -469,15 +469,15 @@ static inline bool zig_addo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t | ... | @@ -469,15 +469,15 @@ static inline bool zig_addo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t |
| 469 | static inline bool zig_addo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t min, int32_t max) { | 469 | static inline bool zig_addo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t min, int32_t max) { |
| 470 | #if defined(__GNUC__) && INT32_MAX == INT_MAX | 470 | #if defined(__GNUC__) && INT32_MAX == INT_MAX |
| 471 | if (min == INT32_MIN && max == INT32_MAX) { | 471 | if (min == INT32_MIN && max == INT32_MAX) { |
| 472 | return __builtin_sadd_overflow(lhs, rhs, res); | 472 | return __builtin_sadd_overflow(lhs, rhs, (int*)res); |
| 473 | } | 473 | } |
| 474 | #elif defined(__GNUC__) && INT32_MAX == LONG_MAX | 474 | #elif defined(__GNUC__) && INT32_MAX == LONG_MAX |
| 475 | if (min == INT32_MIN && max == INT32_MAX) { | 475 | if (min == INT32_MIN && max == INT32_MAX) { |
| 476 | return __builtin_saddl_overflow(lhs, rhs, res); | 476 | return __builtin_saddl_overflow(lhs, rhs, (long*)res); |
| 477 | } | 477 | } |
| 478 | #elif defined(__GNUC__) && INT32_MAX == LLONG_MAX | 478 | #elif defined(__GNUC__) && INT32_MAX == LLONG_MAX |
| 479 | if (min == INT32_MIN && max == INT32_MAX) { | 479 | if (min == INT32_MIN && max == INT32_MAX) { |
| 480 | return __builtin_saddll_overflow(lhs, rhs, res); | 480 | return __builtin_saddll_overflow(lhs, rhs, (long long*)res); |
| 481 | } | 481 | } |
| 482 | #endif | 482 | #endif |
| 483 | int64_t big_result = (int64_t)lhs + (int64_t)rhs; | 483 | int64_t big_result = (int64_t)lhs + (int64_t)rhs; |
| ... | @@ -496,11 +496,11 @@ static inline bool zig_addo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t | ... | @@ -496,11 +496,11 @@ static inline bool zig_addo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t |
| 496 | static inline bool zig_addo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t min, int64_t max) { | 496 | static inline bool zig_addo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t min, int64_t max) { |
| 497 | bool overflow; | 497 | bool overflow; |
| 498 | #if defined(__GNUC__) && INT64_MAX == INT_MAX | 498 | #if defined(__GNUC__) && INT64_MAX == INT_MAX |
| 499 | overflow = __builtin_sadd_overflow(lhs, rhs, res); | 499 | overflow = __builtin_sadd_overflow(lhs, rhs, (int*)res); |
| 500 | #elif defined(__GNUC__) && INT64_MAX == LONG_MAX | 500 | #elif defined(__GNUC__) && INT64_MAX == LONG_MAX |
| 501 | overflow = __builtin_saddl_overflow(lhs, rhs, res); | 501 | overflow = __builtin_saddl_overflow(lhs, rhs, (long*)res); |
| 502 | #elif defined(__GNUC__) && INT64_MAX == LLONG_MAX | 502 | #elif defined(__GNUC__) && INT64_MAX == LLONG_MAX |
| 503 | overflow = __builtin_saddll_overflow(lhs, rhs, res); | 503 | overflow = __builtin_saddll_overflow(lhs, rhs, (long long*)res); |
| 504 | #else | 504 | #else |
| 505 | int int_overflow; | 505 | int int_overflow; |
| 506 | *res = __addodi4(lhs, rhs, &int_overflow); | 506 | *res = __addodi4(lhs, rhs, &int_overflow); |
| ... | @@ -521,11 +521,11 @@ static inline bool zig_addo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t | ... | @@ -521,11 +521,11 @@ static inline bool zig_addo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t |
| 521 | static inline bool zig_addo_i128(int128_t lhs, int128_t rhs, int128_t *res, int128_t min, int128_t max) { | 521 | static inline bool zig_addo_i128(int128_t lhs, int128_t rhs, int128_t *res, int128_t min, int128_t max) { |
| 522 | bool overflow; | 522 | bool overflow; |
| 523 | #if defined(__GNUC__) && INT128_MAX == INT_MAX | 523 | #if defined(__GNUC__) && INT128_MAX == INT_MAX |
| 524 | overflow = __builtin_sadd_overflow(lhs, rhs, res); | 524 | overflow = __builtin_sadd_overflow(lhs, rhs, (int*)res); |
| 525 | #elif defined(__GNUC__) && INT128_MAX == LONG_MAX | 525 | #elif defined(__GNUC__) && INT128_MAX == LONG_MAX |
| 526 | overflow = __builtin_saddl_overflow(lhs, rhs, res); | 526 | overflow = __builtin_saddl_overflow(lhs, rhs, (long*)res); |
| 527 | #elif defined(__GNUC__) && INT128_MAX == LLONG_MAX | 527 | #elif defined(__GNUC__) && INT128_MAX == LLONG_MAX |
| 528 | overflow = __builtin_saddll_overflow(lhs, rhs, res); | 528 | overflow = __builtin_saddll_overflow(lhs, rhs, (long long*)res); |
| 529 | #else | 529 | #else |
| 530 | int int_overflow; | 530 | int int_overflow; |
| 531 | *res = __addoti4(lhs, rhs, &int_overflow); | 531 | *res = __addoti4(lhs, rhs, &int_overflow); |
| ... | @@ -546,15 +546,15 @@ static inline bool zig_addo_i128(int128_t lhs, int128_t rhs, int128_t *res, int1 | ... | @@ -546,15 +546,15 @@ static inline bool zig_addo_i128(int128_t lhs, int128_t rhs, int128_t *res, int1 |
| 546 | static inline bool zig_addo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t max) { | 546 | static inline bool zig_addo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t max) { |
| 547 | #if defined(__GNUC__) && UINT8_MAX == UINT_MAX | 547 | #if defined(__GNUC__) && UINT8_MAX == UINT_MAX |
| 548 | if (max == UINT8_MAX) { | 548 | if (max == UINT8_MAX) { |
| 549 | return __builtin_uadd_overflow(lhs, rhs, res); | 549 | return __builtin_uadd_overflow(lhs, rhs, (unsigned int*)res); |
| 550 | } | 550 | } |
| 551 | #elif defined(__GNUC__) && UINT8_MAX == ULONG_MAX | 551 | #elif defined(__GNUC__) && UINT8_MAX == ULONG_MAX |
| 552 | if (max == UINT8_MAX) { | 552 | if (max == UINT8_MAX) { |
| 553 | return __builtin_uaddl_overflow(lhs, rhs, res); | 553 | return __builtin_uaddl_overflow(lhs, rhs, (unsigned long*)res); |
| 554 | } | 554 | } |
| 555 | #elif defined(__GNUC__) && UINT8_MAX == ULLONG_MAX | 555 | #elif defined(__GNUC__) && UINT8_MAX == ULLONG_MAX |
| 556 | if (max == UINT8_MAX) { | 556 | if (max == UINT8_MAX) { |
| 557 | return __builtin_uaddll_overflow(lhs, rhs, res); | 557 | return __builtin_uaddll_overflow(lhs, rhs, (unsigned long long*)res); |
| 558 | } | 558 | } |
| 559 | #endif | 559 | #endif |
| 560 | uint16_t big_result = (uint16_t)lhs + (uint16_t)rhs; | 560 | uint16_t big_result = (uint16_t)lhs + (uint16_t)rhs; |
| ... | @@ -569,15 +569,15 @@ static inline bool zig_addo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t m | ... | @@ -569,15 +569,15 @@ static inline bool zig_addo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t m |
| 569 | static inline uint16_t zig_addo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, uint16_t max) { | 569 | static inline uint16_t zig_addo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, uint16_t max) { |
| 570 | #if defined(__GNUC__) && UINT16_MAX == UINT_MAX | 570 | #if defined(__GNUC__) && UINT16_MAX == UINT_MAX |
| 571 | if (max == UINT16_MAX) { | 571 | if (max == UINT16_MAX) { |
| 572 | return __builtin_uadd_overflow(lhs, rhs, res); | 572 | return __builtin_uadd_overflow(lhs, rhs, (unsigned int*)res); |
| 573 | } | 573 | } |
| 574 | #elif defined(__GNUC__) && UINT16_MAX == ULONG_MAX | 574 | #elif defined(__GNUC__) && UINT16_MAX == ULONG_MAX |
| 575 | if (max == UINT16_MAX) { | 575 | if (max == UINT16_MAX) { |
| 576 | return __builtin_uaddl_overflow(lhs, rhs, res); | 576 | return __builtin_uaddl_overflow(lhs, rhs, (unsigned long*)res); |
| 577 | } | 577 | } |
| 578 | #elif defined(__GNUC__) && UINT16_MAX == ULLONG_MAX | 578 | #elif defined(__GNUC__) && UINT16_MAX == ULLONG_MAX |
| 579 | if (max == UINT16_MAX) { | 579 | if (max == UINT16_MAX) { |
| 580 | return __builtin_uaddll_overflow(lhs, rhs, res); | 580 | return __builtin_uaddll_overflow(lhs, rhs, (unsigned long long*)res); |
| 581 | } | 581 | } |
| 582 | #endif | 582 | #endif |
| 583 | uint32_t big_result = (uint32_t)lhs + (uint32_t)rhs; | 583 | uint32_t big_result = (uint32_t)lhs + (uint32_t)rhs; |
| ... | @@ -592,15 +592,15 @@ static inline uint16_t zig_addo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, u | ... | @@ -592,15 +592,15 @@ static inline uint16_t zig_addo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, u |
| 592 | static inline uint32_t zig_addo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, uint32_t max) { | 592 | static inline uint32_t zig_addo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, uint32_t max) { |
| 593 | #if defined(__GNUC__) && UINT32_MAX == UINT_MAX | 593 | #if defined(__GNUC__) && UINT32_MAX == UINT_MAX |
| 594 | if (max == UINT32_MAX) { | 594 | if (max == UINT32_MAX) { |
| 595 | return __builtin_uadd_overflow(lhs, rhs, res); | 595 | return __builtin_uadd_overflow(lhs, rhs, (unsigned int*)res); |
| 596 | } | 596 | } |
| 597 | #elif defined(__GNUC__) && UINT32_MAX == ULONG_MAX | 597 | #elif defined(__GNUC__) && UINT32_MAX == ULONG_MAX |
| 598 | if (max == UINT32_MAX) { | 598 | if (max == UINT32_MAX) { |
| 599 | return __builtin_uaddl_overflow(lhs, rhs, res); | 599 | return __builtin_uaddl_overflow(lhs, rhs, (unsigned long*)res); |
| 600 | } | 600 | } |
| 601 | #elif defined(__GNUC__) && UINT32_MAX == ULLONG_MAX | 601 | #elif defined(__GNUC__) && UINT32_MAX == ULLONG_MAX |
| 602 | if (max == UINT32_MAX) { | 602 | if (max == UINT32_MAX) { |
| 603 | return __builtin_uaddll_overflow(lhs, rhs, res); | 603 | return __builtin_uaddll_overflow(lhs, rhs, (unsigned long long*)res); |
| 604 | } | 604 | } |
| 605 | #endif | 605 | #endif |
| 606 | uint64_t big_result = (uint64_t)lhs + (uint64_t)rhs; | 606 | uint64_t big_result = (uint64_t)lhs + (uint64_t)rhs; |
| ... | @@ -615,11 +615,11 @@ static inline uint32_t zig_addo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, u | ... | @@ -615,11 +615,11 @@ static inline uint32_t zig_addo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, u |
| 615 | static inline uint64_t zig_addo_u64(uint64_t lhs, uint64_t rhs, uint64_t *res, uint64_t max) { | 615 | static inline uint64_t zig_addo_u64(uint64_t lhs, uint64_t rhs, uint64_t *res, uint64_t max) { |
| 616 | bool overflow; | 616 | bool overflow; |
| 617 | #if defined(__GNUC__) && UINT64_MAX == UINT_MAX | 617 | #if defined(__GNUC__) && UINT64_MAX == UINT_MAX |
| 618 | overflow = __builtin_uadd_overflow(lhs, rhs, res); | 618 | overflow = __builtin_uadd_overflow(lhs, rhs, (unsigned int*)res); |
| 619 | #elif defined(__GNUC__) && UINT64_MAX == ULONG_MAX | 619 | #elif defined(__GNUC__) && UINT64_MAX == ULONG_MAX |
| 620 | overflow = __builtin_uaddl_overflow(lhs, rhs, res); | 620 | overflow = __builtin_uaddl_overflow(lhs, rhs, (unsigned long*)res); |
| 621 | #elif defined(__GNUC__) && UINT64_MAX == ULLONG_MAX | 621 | #elif defined(__GNUC__) && UINT64_MAX == ULLONG_MAX |
| 622 | overflow = __builtin_uaddll_overflow(lhs, rhs, res); | 622 | overflow = __builtin_uaddll_overflow(lhs, rhs, (unsigned long long*)res); |
| 623 | #else | 623 | #else |
| 624 | int int_overflow; | 624 | int int_overflow; |
| 625 | *res = __uaddodi4(lhs, rhs, &int_overflow); | 625 | *res = __uaddodi4(lhs, rhs, &int_overflow); |
| ... | @@ -645,15 +645,15 @@ static inline uint128_t zig_addo_u128(uint128_t lhs, uint128_t rhs, uint128_t *r | ... | @@ -645,15 +645,15 @@ static inline uint128_t zig_addo_u128(uint128_t lhs, uint128_t rhs, uint128_t *r |
| 645 | static inline bool zig_subo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, int8_t max) { | 645 | static inline bool zig_subo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, int8_t max) { |
| 646 | #if defined(__GNUC__) && INT8_MAX == INT_MAX | 646 | #if defined(__GNUC__) && INT8_MAX == INT_MAX |
| 647 | if (min == INT8_MIN && max == INT8_MAX) { | 647 | if (min == INT8_MIN && max == INT8_MAX) { |
| 648 | return __builtin_ssub_overflow(lhs, rhs, res); | 648 | return __builtin_ssub_overflow(lhs, rhs, (int*)res); |
| 649 | } | 649 | } |
| 650 | #elif defined(__GNUC__) && INT8_MAX == LONG_MAX | 650 | #elif defined(__GNUC__) && INT8_MAX == LONG_MAX |
| 651 | if (min == INT8_MIN && max == INT8_MAX) { | 651 | if (min == INT8_MIN && max == INT8_MAX) { |
| 652 | return __builtin_ssubl_overflow(lhs, rhs, res); | 652 | return __builtin_ssubl_overflow(lhs, rhs, (long*)res); |
| 653 | } | 653 | } |
| 654 | #elif defined(__GNUC__) && INT8_MAX == LLONG_MAX | 654 | #elif defined(__GNUC__) && INT8_MAX == LLONG_MAX |
| 655 | if (min == INT8_MIN && max == INT8_MAX) { | 655 | if (min == INT8_MIN && max == INT8_MAX) { |
| 656 | return __builtin_ssubll_overflow(lhs, rhs, res); | 656 | return __builtin_ssubll_overflow(lhs, rhs, (long long*)res); |
| 657 | } | 657 | } |
| 658 | #endif | 658 | #endif |
| 659 | int16_t big_result = (int16_t)lhs - (int16_t)rhs; | 659 | int16_t big_result = (int16_t)lhs - (int16_t)rhs; |
| ... | @@ -672,15 +672,15 @@ static inline bool zig_subo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, | ... | @@ -672,15 +672,15 @@ static inline bool zig_subo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, |
| 672 | static inline bool zig_subo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t min, int16_t max) { | 672 | static inline bool zig_subo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t min, int16_t max) { |
| 673 | #if defined(__GNUC__) && INT16_MAX == INT_MAX | 673 | #if defined(__GNUC__) && INT16_MAX == INT_MAX |
| 674 | if (min == INT16_MIN && max == INT16_MAX) { | 674 | if (min == INT16_MIN && max == INT16_MAX) { |
| 675 | return __builtin_ssub_overflow(lhs, rhs, res); | 675 | return __builtin_ssub_overflow(lhs, rhs, (int*)res); |
| 676 | } | 676 | } |
| 677 | #elif defined(__GNUC__) && INT16_MAX == LONG_MAX | 677 | #elif defined(__GNUC__) && INT16_MAX == LONG_MAX |
| 678 | if (min == INT16_MIN && max == INT16_MAX) { | 678 | if (min == INT16_MIN && max == INT16_MAX) { |
| 679 | return __builtin_ssubl_overflow(lhs, rhs, res); | 679 | return __builtin_ssubl_overflow(lhs, rhs, (long*)res); |
| 680 | } | 680 | } |
| 681 | #elif defined(__GNUC__) && INT16_MAX == LLONG_MAX | 681 | #elif defined(__GNUC__) && INT16_MAX == LLONG_MAX |
| 682 | if (min == INT16_MIN && max == INT16_MAX) { | 682 | if (min == INT16_MIN && max == INT16_MAX) { |
| 683 | return __builtin_ssubll_overflow(lhs, rhs, res); | 683 | return __builtin_ssubll_overflow(lhs, rhs, (long long*)res); |
| 684 | } | 684 | } |
| 685 | #endif | 685 | #endif |
| 686 | int32_t big_result = (int32_t)lhs - (int32_t)rhs; | 686 | int32_t big_result = (int32_t)lhs - (int32_t)rhs; |
| ... | @@ -699,15 +699,15 @@ static inline bool zig_subo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t | ... | @@ -699,15 +699,15 @@ static inline bool zig_subo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t |
| 699 | static inline bool zig_subo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t min, int32_t max) { | 699 | static inline bool zig_subo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t min, int32_t max) { |
| 700 | #if defined(__GNUC__) && INT32_MAX == INT_MAX | 700 | #if defined(__GNUC__) && INT32_MAX == INT_MAX |
| 701 | if (min == INT32_MIN && max == INT32_MAX) { | 701 | if (min == INT32_MIN && max == INT32_MAX) { |
| 702 | return __builtin_ssub_overflow(lhs, rhs, res); | 702 | return __builtin_ssub_overflow(lhs, rhs, (int*)res); |
| 703 | } | 703 | } |
| 704 | #elif defined(__GNUC__) && INT32_MAX == LONG_MAX | 704 | #elif defined(__GNUC__) && INT32_MAX == LONG_MAX |
| 705 | if (min == INT32_MIN && max == INT32_MAX) { | 705 | if (min == INT32_MIN && max == INT32_MAX) { |
| 706 | return __builtin_ssubl_overflow(lhs, rhs, res); | 706 | return __builtin_ssubl_overflow(lhs, rhs, (long*)res); |
| 707 | } | 707 | } |
| 708 | #elif defined(__GNUC__) && INT32_MAX == LLONG_MAX | 708 | #elif defined(__GNUC__) && INT32_MAX == LLONG_MAX |
| 709 | if (min == INT32_MIN && max == INT32_MAX) { | 709 | if (min == INT32_MIN && max == INT32_MAX) { |
| 710 | return __builtin_ssubll_overflow(lhs, rhs, res); | 710 | return __builtin_ssubll_overflow(lhs, rhs, (long long*)res); |
| 711 | } | 711 | } |
| 712 | #endif | 712 | #endif |
| 713 | int64_t big_result = (int64_t)lhs - (int64_t)rhs; | 713 | int64_t big_result = (int64_t)lhs - (int64_t)rhs; |
| ... | @@ -726,11 +726,11 @@ static inline bool zig_subo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t | ... | @@ -726,11 +726,11 @@ static inline bool zig_subo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t |
| 726 | static inline bool zig_subo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t min, int64_t max) { | 726 | static inline bool zig_subo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t min, int64_t max) { |
| 727 | bool overflow; | 727 | bool overflow; |
| 728 | #if defined(__GNUC__) && INT64_MAX == INT_MAX | 728 | #if defined(__GNUC__) && INT64_MAX == INT_MAX |
| 729 | overflow = __builtin_ssub_overflow(lhs, rhs, res); | 729 | overflow = __builtin_ssub_overflow(lhs, rhs, (int*)res); |
| 730 | #elif defined(__GNUC__) && INT64_MAX == LONG_MAX | 730 | #elif defined(__GNUC__) && INT64_MAX == LONG_MAX |
| 731 | overflow = __builtin_ssubl_overflow(lhs, rhs, res); | 731 | overflow = __builtin_ssubl_overflow(lhs, rhs, (long*)res); |
| 732 | #elif defined(__GNUC__) && INT64_MAX == LLONG_MAX | 732 | #elif defined(__GNUC__) && INT64_MAX == LLONG_MAX |
| 733 | overflow = __builtin_ssubll_overflow(lhs, rhs, res); | 733 | overflow = __builtin_ssubll_overflow(lhs, rhs, (long long*)res); |
| 734 | #else | 734 | #else |
| 735 | int int_overflow; | 735 | int int_overflow; |
| 736 | *res = __subodi4(lhs, rhs, &int_overflow); | 736 | *res = __subodi4(lhs, rhs, &int_overflow); |
| ... | @@ -751,11 +751,11 @@ static inline bool zig_subo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t | ... | @@ -751,11 +751,11 @@ static inline bool zig_subo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t |
| 751 | static inline bool zig_subo_i128(int128_t lhs, int128_t rhs, int128_t *res, int128_t min, int128_t max) { | 751 | static inline bool zig_subo_i128(int128_t lhs, int128_t rhs, int128_t *res, int128_t min, int128_t max) { |
| 752 | bool overflow; | 752 | bool overflow; |
| 753 | #if defined(__GNUC__) && INT128_MAX == INT_MAX | 753 | #if defined(__GNUC__) && INT128_MAX == INT_MAX |
| 754 | overflow = __builtin_ssub_overflow(lhs, rhs, res); | 754 | overflow = __builtin_ssub_overflow(lhs, rhs, (int*)res); |
| 755 | #elif defined(__GNUC__) && INT128_MAX == LONG_MAX | 755 | #elif defined(__GNUC__) && INT128_MAX == LONG_MAX |
| 756 | overflow = __builtin_ssubl_overflow(lhs, rhs, res); | 756 | overflow = __builtin_ssubl_overflow(lhs, rhs, (long*)res); |
| 757 | #elif defined(__GNUC__) && INT128_MAX == LLONG_MAX | 757 | #elif defined(__GNUC__) && INT128_MAX == LLONG_MAX |
| 758 | overflow = __builtin_ssubll_overflow(lhs, rhs, res); | 758 | overflow = __builtin_ssubll_overflow(lhs, rhs, (long long*)res); |
| 759 | #else | 759 | #else |
| 760 | int int_overflow; | 760 | int int_overflow; |
| 761 | *res = __suboti4(lhs, rhs, &int_overflow); | 761 | *res = __suboti4(lhs, rhs, &int_overflow); |
| ... | @@ -775,11 +775,11 @@ static inline bool zig_subo_i128(int128_t lhs, int128_t rhs, int128_t *res, int1 | ... | @@ -775,11 +775,11 @@ static inline bool zig_subo_i128(int128_t lhs, int128_t rhs, int128_t *res, int1 |
| 775 | | 775 | |
| 776 | static inline bool zig_subo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t max) { | 776 | static inline bool zig_subo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t max) { |
| 777 | #if defined(__GNUC__) && UINT8_MAX == UINT_MAX | 777 | #if defined(__GNUC__) && UINT8_MAX == UINT_MAX |
| 778 | return __builtin_usub_overflow(lhs, rhs, res); | 778 | return __builtin_usub_overflow(lhs, rhs, (unsigned int*)res); |
| 779 | #elif defined(__GNUC__) && UINT8_MAX == ULONG_MAX | 779 | #elif defined(__GNUC__) && UINT8_MAX == ULONG_MAX |
| 780 | return __builtin_usubl_overflow(lhs, rhs, res); | 780 | return __builtin_usubl_overflow(lhs, rhs, (unsigned long*)res); |
| 781 | #elif defined(__GNUC__) && UINT8_MAX == ULLONG_MAX | 781 | #elif defined(__GNUC__) && UINT8_MAX == ULLONG_MAX |
| 782 | return __builtin_usubll_overflow(lhs, rhs, res); | 782 | return __builtin_usubll_overflow(lhs, rhs, (unsigned long long*)res); |
| 783 | #endif | 783 | #endif |
| 784 | if (rhs > lhs) { | 784 | if (rhs > lhs) { |
| 785 | *res = max - (rhs - lhs - 1); | 785 | *res = max - (rhs - lhs - 1); |
| ... | @@ -791,11 +791,11 @@ static inline bool zig_subo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t m | ... | @@ -791,11 +791,11 @@ static inline bool zig_subo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t m |
| 791 | | 791 | |
| 792 | static inline uint16_t zig_subo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, uint16_t max) { | 792 | static inline uint16_t zig_subo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, uint16_t max) { |
| 793 | #if defined(__GNUC__) && UINT16_MAX == UINT_MAX | 793 | #if defined(__GNUC__) && UINT16_MAX == UINT_MAX |
| 794 | return __builtin_usub_overflow(lhs, rhs, res); | 794 | return __builtin_usub_overflow(lhs, rhs, (unsigned int*)res); |
| 795 | #elif defined(__GNUC__) && UINT16_MAX == ULONG_MAX | 795 | #elif defined(__GNUC__) && UINT16_MAX == ULONG_MAX |
| 796 | return __builtin_usubl_overflow(lhs, rhs, res); | 796 | return __builtin_usubl_overflow(lhs, rhs, (unsigned long*)res); |
| 797 | #elif defined(__GNUC__) && UINT16_MAX == ULLONG_MAX | 797 | #elif defined(__GNUC__) && UINT16_MAX == ULLONG_MAX |
| 798 | return __builtin_usubll_overflow(lhs, rhs, res); | 798 | return __builtin_usubll_overflow(lhs, rhs, (unsigned long long*)res); |
| 799 | #endif | 799 | #endif |
| 800 | if (rhs > lhs) { | 800 | if (rhs > lhs) { |
| 801 | *res = max - (rhs - lhs - 1); | 801 | *res = max - (rhs - lhs - 1); |
| ... | @@ -808,11 +808,11 @@ static inline uint16_t zig_subo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, u | ... | @@ -808,11 +808,11 @@ static inline uint16_t zig_subo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, u |
| 808 | static inline uint32_t zig_subo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, uint32_t max) { | 808 | static inline uint32_t zig_subo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, uint32_t max) { |
| 809 | if (max == UINT32_MAX) { | 809 | if (max == UINT32_MAX) { |
| 810 | #if defined(__GNUC__) && UINT32_MAX == UINT_MAX | 810 | #if defined(__GNUC__) && UINT32_MAX == UINT_MAX |
| 811 | return __builtin_usub_overflow(lhs, rhs, res); | 811 | return __builtin_usub_overflow(lhs, rhs, (unsigned int*)res); |
| 812 | #elif defined(__GNUC__) && UINT32_MAX == ULONG_MAX | 812 | #elif defined(__GNUC__) && UINT32_MAX == ULONG_MAX |
| 813 | return __builtin_usubl_overflow(lhs, rhs, res); | 813 | return __builtin_usubl_overflow(lhs, rhs, (unsigned long*)res); |
| 814 | #elif defined(__GNUC__) && UINT32_MAX == ULLONG_MAX | 814 | #elif defined(__GNUC__) && UINT32_MAX == ULLONG_MAX |
| 815 | return __builtin_usubll_overflow(lhs, rhs, res); | 815 | return __builtin_usubll_overflow(lhs, rhs, (unsigned long long*)res); |
| 816 | #endif | 816 | #endif |
| 817 | int int_overflow; | 817 | int int_overflow; |
| 818 | *res = __usubosi4(lhs, rhs, &int_overflow); | 818 | *res = __usubosi4(lhs, rhs, &int_overflow); |
| ... | @@ -830,11 +830,11 @@ static inline uint32_t zig_subo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, u | ... | @@ -830,11 +830,11 @@ static inline uint32_t zig_subo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, u |
| 830 | static inline uint64_t zig_subo_u64(uint64_t lhs, uint64_t rhs, uint64_t *res, uint64_t max) { | 830 | static inline uint64_t zig_subo_u64(uint64_t lhs, uint64_t rhs, uint64_t *res, uint64_t max) { |
| 831 | if (max == UINT64_MAX) { | 831 | if (max == UINT64_MAX) { |
| 832 | #if defined(__GNUC__) && UINT64_MAX == UINT_MAX | 832 | #if defined(__GNUC__) && UINT64_MAX == UINT_MAX |
| 833 | return __builtin_usub_overflow(lhs, rhs, res); | 833 | return __builtin_usub_overflow(lhs, rhs, (unsigned int*)res); |
| 834 | #elif defined(__GNUC__) && UINT64_MAX == ULONG_MAX | 834 | #elif defined(__GNUC__) && UINT64_MAX == ULONG_MAX |
| 835 | return __builtin_usubl_overflow(lhs, rhs, res); | 835 | return __builtin_usubl_overflow(lhs, rhs, (unsigned long*)res); |
| 836 | #elif defined(__GNUC__) && UINT64_MAX == ULLONG_MAX | 836 | #elif defined(__GNUC__) && UINT64_MAX == ULLONG_MAX |
| 837 | return __builtin_usubll_overflow(lhs, rhs, res); | 837 | return __builtin_usubll_overflow(lhs, rhs, (unsigned long long*)res); |
| 838 | #else | 838 | #else |
| 839 | int int_overflow; | 839 | int int_overflow; |
| 840 | *res = __usubodi4(lhs, rhs, &int_overflow); | 840 | *res = __usubodi4(lhs, rhs, &int_overflow); |
| ... | @@ -868,15 +868,15 @@ static inline uint128_t zig_subo_u128(uint128_t lhs, uint128_t rhs, uint128_t *r | ... | @@ -868,15 +868,15 @@ static inline uint128_t zig_subo_u128(uint128_t lhs, uint128_t rhs, uint128_t *r |
| 868 | static inline bool zig_mulo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, int8_t max) { | 868 | static inline bool zig_mulo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, int8_t max) { |
| 869 | #if defined(__GNUC__) && INT8_MAX == INT_MAX | 869 | #if defined(__GNUC__) && INT8_MAX == INT_MAX |
| 870 | if (min == INT8_MIN && max == INT8_MAX) { | 870 | if (min == INT8_MIN && max == INT8_MAX) { |
| 871 | return __builtin_smul_overflow(lhs, rhs, res); | 871 | return __builtin_smul_overflow(lhs, rhs, (int*)res); |
| 872 | } | 872 | } |
| 873 | #elif defined(__GNUC__) && INT8_MAX == LONG_MAX | 873 | #elif defined(__GNUC__) && INT8_MAX == LONG_MAX |
| 874 | if (min == INT8_MIN && max == INT8_MAX) { | 874 | if (min == INT8_MIN && max == INT8_MAX) { |
| 875 | return __builtin_smull_overflow(lhs, rhs, res); | 875 | return __builtin_smull_overflow(lhs, rhs, (long*)res); |
| 876 | } | 876 | } |
| 877 | #elif defined(__GNUC__) && INT8_MAX == LLONG_MAX | 877 | #elif defined(__GNUC__) && INT8_MAX == LLONG_MAX |
| 878 | if (min == INT8_MIN && max == INT8_MAX) { | 878 | if (min == INT8_MIN && max == INT8_MAX) { |
| 879 | return __builtin_smulll_overflow(lhs, rhs, res); | 879 | return __builtin_smulll_overflow(lhs, rhs, (long long*)res); |
| 880 | } | 880 | } |
| 881 | #endif | 881 | #endif |
| 882 | int16_t big_result = (int16_t)lhs * (int16_t)rhs; | 882 | int16_t big_result = (int16_t)lhs * (int16_t)rhs; |
| ... | @@ -895,15 +895,15 @@ static inline bool zig_mulo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, | ... | @@ -895,15 +895,15 @@ static inline bool zig_mulo_i8(int8_t lhs, int8_t rhs, int8_t *res, int8_t min, |
| 895 | static inline bool zig_mulo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t min, int16_t max) { | 895 | static inline bool zig_mulo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t min, int16_t max) { |
| 896 | #if defined(__GNUC__) && INT16_MAX == INT_MAX | 896 | #if defined(__GNUC__) && INT16_MAX == INT_MAX |
| 897 | if (min == INT16_MIN && max == INT16_MAX) { | 897 | if (min == INT16_MIN && max == INT16_MAX) { |
| 898 | return __builtin_smul_overflow(lhs, rhs, res); | 898 | return __builtin_smul_overflow(lhs, rhs, (int*)res); |
| 899 | } | 899 | } |
| 900 | #elif defined(__GNUC__) && INT16_MAX == LONG_MAX | 900 | #elif defined(__GNUC__) && INT16_MAX == LONG_MAX |
| 901 | if (min == INT16_MIN && max == INT16_MAX) { | 901 | if (min == INT16_MIN && max == INT16_MAX) { |
| 902 | return __builtin_smull_overflow(lhs, rhs, res); | 902 | return __builtin_smull_overflow(lhs, rhs, (long*)res); |
| 903 | } | 903 | } |
| 904 | #elif defined(__GNUC__) && INT16_MAX == LLONG_MAX | 904 | #elif defined(__GNUC__) && INT16_MAX == LLONG_MAX |
| 905 | if (min == INT16_MIN && max == INT16_MAX) { | 905 | if (min == INT16_MIN && max == INT16_MAX) { |
| 906 | return __builtin_smulll_overflow(lhs, rhs, res); | 906 | return __builtin_smulll_overflow(lhs, rhs, (long long*)res); |
| 907 | } | 907 | } |
| 908 | #endif | 908 | #endif |
| 909 | int32_t big_result = (int32_t)lhs * (int32_t)rhs; | 909 | int32_t big_result = (int32_t)lhs * (int32_t)rhs; |
| ... | @@ -922,15 +922,15 @@ static inline bool zig_mulo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t | ... | @@ -922,15 +922,15 @@ static inline bool zig_mulo_i16(int16_t lhs, int16_t rhs, int16_t *res, int16_t |
| 922 | static inline bool zig_mulo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t min, int32_t max) { | 922 | static inline bool zig_mulo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t min, int32_t max) { |
| 923 | #if defined(__GNUC__) && INT32_MAX == INT_MAX | 923 | #if defined(__GNUC__) && INT32_MAX == INT_MAX |
| 924 | if (min == INT32_MIN && max == INT32_MAX) { | 924 | if (min == INT32_MIN && max == INT32_MAX) { |
| 925 | return __builtin_smul_overflow(lhs, rhs, res); | 925 | return __builtin_smul_overflow(lhs, rhs, (int*)res); |
| 926 | } | 926 | } |
| 927 | #elif defined(__GNUC__) && INT32_MAX == LONG_MAX | 927 | #elif defined(__GNUC__) && INT32_MAX == LONG_MAX |
| 928 | if (min == INT32_MIN && max == INT32_MAX) { | 928 | if (min == INT32_MIN && max == INT32_MAX) { |
| 929 | return __builtin_smull_overflow(lhs, rhs, res); | 929 | return __builtin_smull_overflow(lhs, rhs, (long*)res); |
| 930 | } | 930 | } |
| 931 | #elif defined(__GNUC__) && INT32_MAX == LLONG_MAX | 931 | #elif defined(__GNUC__) && INT32_MAX == LLONG_MAX |
| 932 | if (min == INT32_MIN && max == INT32_MAX) { | 932 | if (min == INT32_MIN && max == INT32_MAX) { |
| 933 | return __builtin_smulll_overflow(lhs, rhs, res); | 933 | return __builtin_smulll_overflow(lhs, rhs, (long long*)res); |
| 934 | } | 934 | } |
| 935 | #endif | 935 | #endif |
| 936 | int64_t big_result = (int64_t)lhs * (int64_t)rhs; | 936 | int64_t big_result = (int64_t)lhs * (int64_t)rhs; |
| ... | @@ -949,11 +949,11 @@ static inline bool zig_mulo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t | ... | @@ -949,11 +949,11 @@ static inline bool zig_mulo_i32(int32_t lhs, int32_t rhs, int32_t *res, int32_t |
| 949 | static inline bool zig_mulo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t min, int64_t max) { | 949 | static inline bool zig_mulo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t min, int64_t max) { |
| 950 | bool overflow; | 950 | bool overflow; |
| 951 | #if defined(__GNUC__) && INT64_MAX == INT_MAX | 951 | #if defined(__GNUC__) && INT64_MAX == INT_MAX |
| 952 | overflow = __builtin_smul_overflow(lhs, rhs, res); | 952 | overflow = __builtin_smul_overflow(lhs, rhs, (int*)res); |
| 953 | #elif defined(__GNUC__) && INT64_MAX == LONG_MAX | 953 | #elif defined(__GNUC__) && INT64_MAX == LONG_MAX |
| 954 | overflow = __builtin_smull_overflow(lhs, rhs, res); | 954 | overflow = __builtin_smull_overflow(lhs, rhs, (long*)res); |
| 955 | #elif defined(__GNUC__) && INT64_MAX == LLONG_MAX | 955 | #elif defined(__GNUC__) && INT64_MAX == LLONG_MAX |
| 956 | overflow = __builtin_smulll_overflow(lhs, rhs, res); | 956 | overflow = __builtin_smulll_overflow(lhs, rhs, (long long*)res); |
| 957 | #else | 957 | #else |
| 958 | int int_overflow; | 958 | int int_overflow; |
| 959 | *res = __mulodi4(lhs, rhs, &int_overflow); | 959 | *res = __mulodi4(lhs, rhs, &int_overflow); |
| ... | @@ -974,11 +974,11 @@ static inline bool zig_mulo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t | ... | @@ -974,11 +974,11 @@ static inline bool zig_mulo_i64(int64_t lhs, int64_t rhs, int64_t *res, int64_t |
| 974 | static inline bool zig_mulo_i128(int128_t lhs, int128_t rhs, int128_t *res, int128_t min, int128_t max) { | 974 | static inline bool zig_mulo_i128(int128_t lhs, int128_t rhs, int128_t *res, int128_t min, int128_t max) { |
| 975 | bool overflow; | 975 | bool overflow; |
| 976 | #if defined(__GNUC__) && INT128_MAX == INT_MAX | 976 | #if defined(__GNUC__) && INT128_MAX == INT_MAX |
| 977 | overflow = __builtin_smul_overflow(lhs, rhs, res); | 977 | overflow = __builtin_smul_overflow(lhs, rhs, (int*)res); |
| 978 | #elif defined(__GNUC__) && INT128_MAX == LONG_MAX | 978 | #elif defined(__GNUC__) && INT128_MAX == LONG_MAX |
| 979 | overflow = __builtin_smull_overflow(lhs, rhs, res); | 979 | overflow = __builtin_smull_overflow(lhs, rhs, (long*)res); |
| 980 | #elif defined(__GNUC__) && INT128_MAX == LLONG_MAX | 980 | #elif defined(__GNUC__) && INT128_MAX == LLONG_MAX |
| 981 | overflow = __builtin_smulll_overflow(lhs, rhs, res); | 981 | overflow = __builtin_smulll_overflow(lhs, rhs, (long long*)res); |
| 982 | #else | 982 | #else |
| 983 | int int_overflow; | 983 | int int_overflow; |
| 984 | *res = __muloti4(lhs, rhs, &int_overflow); | 984 | *res = __muloti4(lhs, rhs, &int_overflow); |
| ... | @@ -999,15 +999,15 @@ static inline bool zig_mulo_i128(int128_t lhs, int128_t rhs, int128_t *res, int1 | ... | @@ -999,15 +999,15 @@ static inline bool zig_mulo_i128(int128_t lhs, int128_t rhs, int128_t *res, int1 |
| 999 | static inline bool zig_mulo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t max) { | 999 | static inline bool zig_mulo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t max) { |
| 1000 | #if defined(__GNUC__) && UINT8_MAX == UINT_MAX | 1000 | #if defined(__GNUC__) && UINT8_MAX == UINT_MAX |
| 1001 | if (max == UINT8_MAX) { | 1001 | if (max == UINT8_MAX) { |
| 1002 | return __builtin_umul_overflow(lhs, rhs, res); | 1002 | return __builtin_umul_overflow(lhs, rhs, (unsigned int*)res); |
| 1003 | } | 1003 | } |
| 1004 | #elif defined(__GNUC__) && UINT8_MAX == ULONG_MAX | 1004 | #elif defined(__GNUC__) && UINT8_MAX == ULONG_MAX |
| 1005 | if (max == UINT8_MAX) { | 1005 | if (max == UINT8_MAX) { |
| 1006 | return __builtin_umull_overflow(lhs, rhs, res); | 1006 | return __builtin_umull_overflow(lhs, rhs, (unsigned long*)res); |
| 1007 | } | 1007 | } |
| 1008 | #elif defined(__GNUC__) && UINT8_MAX == ULLONG_MAX | 1008 | #elif defined(__GNUC__) && UINT8_MAX == ULLONG_MAX |
| 1009 | if (max == UINT8_MAX) { | 1009 | if (max == UINT8_MAX) { |
| 1010 | return __builtin_umulll_overflow(lhs, rhs, res); | 1010 | return __builtin_umulll_overflow(lhs, rhs, (unsigned long long*)res); |
| 1011 | } | 1011 | } |
| 1012 | #endif | 1012 | #endif |
| 1013 | uint16_t big_result = (uint16_t)lhs * (uint16_t)rhs; | 1013 | uint16_t big_result = (uint16_t)lhs * (uint16_t)rhs; |
| ... | @@ -1022,15 +1022,15 @@ static inline bool zig_mulo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t m | ... | @@ -1022,15 +1022,15 @@ static inline bool zig_mulo_u8(uint8_t lhs, uint8_t rhs, uint8_t *res, uint8_t m |
| 1022 | static inline uint16_t zig_mulo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, uint16_t max) { | 1022 | static inline uint16_t zig_mulo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, uint16_t max) { |
| 1023 | #if defined(__GNUC__) && UINT16_MAX == UINT_MAX | 1023 | #if defined(__GNUC__) && UINT16_MAX == UINT_MAX |
| 1024 | if (max == UINT16_MAX) { | 1024 | if (max == UINT16_MAX) { |
| 1025 | return __builtin_umul_overflow(lhs, rhs, res); | 1025 | return __builtin_umul_overflow(lhs, rhs, (unsigned int*)res); |
| 1026 | } | 1026 | } |
| 1027 | #elif defined(__GNUC__) && UINT16_MAX == ULONG_MAX | 1027 | #elif defined(__GNUC__) && UINT16_MAX == ULONG_MAX |
| 1028 | if (max == UINT16_MAX) { | 1028 | if (max == UINT16_MAX) { |
| 1029 | return __builtin_umull_overflow(lhs, rhs, res); | 1029 | return __builtin_umull_overflow(lhs, rhs, (unsigned long*)res); |
| 1030 | } | 1030 | } |
| 1031 | #elif defined(__GNUC__) && UINT16_MAX == ULLONG_MAX | 1031 | #elif defined(__GNUC__) && UINT16_MAX == ULLONG_MAX |
| 1032 | if (max == UINT16_MAX) { | 1032 | if (max == UINT16_MAX) { |
| 1033 | return __builtin_umulll_overflow(lhs, rhs, res); | 1033 | return __builtin_umulll_overflow(lhs, rhs, (unsigned long long*)res); |
| 1034 | } | 1034 | } |
| 1035 | #endif | 1035 | #endif |
| 1036 | uint32_t big_result = (uint32_t)lhs * (uint32_t)rhs; | 1036 | uint32_t big_result = (uint32_t)lhs * (uint32_t)rhs; |
| ... | @@ -1045,15 +1045,15 @@ static inline uint16_t zig_mulo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, u | ... | @@ -1045,15 +1045,15 @@ static inline uint16_t zig_mulo_u16(uint16_t lhs, uint16_t rhs, uint16_t *res, u |
| 1045 | static inline uint32_t zig_mulo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, uint32_t max) { | 1045 | static inline uint32_t zig_mulo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, uint32_t max) { |
| 1046 | #if defined(__GNUC__) && UINT32_MAX == UINT_MAX | 1046 | #if defined(__GNUC__) && UINT32_MAX == UINT_MAX |
| 1047 | if (max == UINT32_MAX) { | 1047 | if (max == UINT32_MAX) { |
| 1048 | return __builtin_umul_overflow(lhs, rhs, res); | 1048 | return __builtin_umul_overflow(lhs, rhs, (unsigned int*)res); |
| 1049 | } | 1049 | } |
| 1050 | #elif defined(__GNUC__) && UINT32_MAX == ULONG_MAX | 1050 | #elif defined(__GNUC__) && UINT32_MAX == ULONG_MAX |
| 1051 | if (max == UINT32_MAX) { | 1051 | if (max == UINT32_MAX) { |
| 1052 | return __builtin_umull_overflow(lhs, rhs, res); | 1052 | return __builtin_umull_overflow(lhs, rhs, (unsigned long*)res); |
| 1053 | } | 1053 | } |
| 1054 | #elif defined(__GNUC__) && UINT32_MAX == ULLONG_MAX | 1054 | #elif defined(__GNUC__) && UINT32_MAX == ULLONG_MAX |
| 1055 | if (max == UINT32_MAX) { | 1055 | if (max == UINT32_MAX) { |
| 1056 | return __builtin_umulll_overflow(lhs, rhs, res); | 1056 | return __builtin_umulll_overflow(lhs, rhs, (unsigned long long*)res); |
| 1057 | } | 1057 | } |
| 1058 | #endif | 1058 | #endif |
| 1059 | uint64_t big_result = (uint64_t)lhs * (uint64_t)rhs; | 1059 | uint64_t big_result = (uint64_t)lhs * (uint64_t)rhs; |
| ... | @@ -1068,11 +1068,11 @@ static inline uint32_t zig_mulo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, u | ... | @@ -1068,11 +1068,11 @@ static inline uint32_t zig_mulo_u32(uint32_t lhs, uint32_t rhs, uint32_t *res, u |
| 1068 | static inline uint64_t zig_mulo_u64(uint64_t lhs, uint64_t rhs, uint64_t *res, uint64_t max) { | 1068 | static inline uint64_t zig_mulo_u64(uint64_t lhs, uint64_t rhs, uint64_t *res, uint64_t max) { |
| 1069 | bool overflow; | 1069 | bool overflow; |
| 1070 | #if defined(__GNUC__) && UINT64_MAX == UINT_MAX | 1070 | #if defined(__GNUC__) && UINT64_MAX == UINT_MAX |
| 1071 | overflow = __builtin_umul_overflow(lhs, rhs, res); | 1071 | overflow = __builtin_umul_overflow(lhs, rhs, (unsigned int*)res); |
| 1072 | #elif defined(__GNUC__) && UINT64_MAX == ULONG_MAX | 1072 | #elif defined(__GNUC__) && UINT64_MAX == ULONG_MAX |
| 1073 | overflow = __builtin_umull_overflow(lhs, rhs, res); | 1073 | overflow = __builtin_umull_overflow(lhs, rhs, (unsigned long*)res); |
| 1074 | #elif defined(__GNUC__) && UINT64_MAX == ULLONG_MAX | 1074 | #elif defined(__GNUC__) && UINT64_MAX == ULLONG_MAX |
| 1075 | overflow = __builtin_umulll_overflow(lhs, rhs, res); | 1075 | overflow = __builtin_umulll_overflow(lhs, rhs, (unsigned long long*)res); |
| 1076 | #else | 1076 | #else |
| 1077 | int int_overflow; | 1077 | int int_overflow; |
| 1078 | *res = __umulodi4(lhs, rhs, &int_overflow); | 1078 | *res = __umulodi4(lhs, rhs, &int_overflow); |