internal_windows.odin 522 B

123456789101112131415161718192021222324
  1. package runtime
  2. @(link_name="__umodti3")
  3. umodti3 :: proc "c" (a, b: i128) -> i128 {
  4. s_a := a >> (128 - 1);
  5. s_b := b >> (128 - 1);
  6. an := (a ~ s_a) - s_a;
  7. bn := (b ~ s_b) - s_b;
  8. r: u128 = ---;
  9. _ = udivmod128(transmute(u128)an, transmute(u128)bn, &r);
  10. return (transmute(i128)r ~ s_a) - s_a;
  11. }
  12. @(link_name="__udivmodti4")
  13. udivmodti4 :: proc "c" (a, b: u128, rem: ^u128) -> u128 {
  14. return udivmod128(a, b, rem);
  15. }
  16. @(link_name="__udivti3")
  17. udivti3 :: proc "c" (a, b: u128) -> u128 {
  18. return udivmodti4(a, b, nil);
  19. }