Skip to content

Commit ad5d6b2

Browse files
author
cetus-developer
committed
migrate sui move edit to 2024
1 parent 5e16652 commit ad5d6b2

7 files changed

Lines changed: 52 additions & 11 deletions

File tree

sui/Move.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
name = "IntegerMate"
55
version = "1.2.0"
66
published-at = "0xf1e4fae2183dabebc4827b0a46ddae9c0d0a6afa06a416e1f887a4ffd33f5067"
7+
edition = "2024"
78

89
[dependencies]
910
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.48.2" }

sui/migration.patch

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--- ./sources/i128.move
2+
+++ ./sources/i128.move
3+
@@ -14 +14 @@
4+
- struct I128 has copy, drop, store {
5+
+ public struct I128 has copy, drop, store {
6+
@@ -53,2 +53,2 @@
7+
- let sum = num1.bits ^ num2.bits;
8+
- let carry = (num1.bits & num2.bits) << 1;
9+
+ let mut sum = num1.bits ^ num2.bits;
10+
+ let mut carry = (num1.bits & num2.bits) << 1;
11+
--- ./sources/i32.move
12+
+++ ./sources/i32.move
13+
@@ -11 +11 @@
14+
- struct I32 has copy, drop, store {
15+
+ public struct I32 has copy, drop, store {
16+
@@ -48,2 +48,2 @@
17+
- let sum = num1.bits ^ num2.bits;
18+
- let carry = (num1.bits & num2.bits) << 1;
19+
+ let mut sum = num1.bits ^ num2.bits;
20+
+ let mut carry = (num1.bits & num2.bits) << 1;
21+
--- ./sources/i64.move
22+
+++ ./sources/i64.move
23+
@@ -11 +11 @@
24+
- struct I64 has copy, drop, store {
25+
+ public struct I64 has copy, drop, store {
26+
@@ -48,2 +48,2 @@
27+
- let sum = num1.bits ^ num2.bits;
28+
- let carry = (num1.bits & num2.bits) << 1;
29+
+ let mut sum = num1.bits ^ num2.bits;
30+
+ let mut carry = (num1.bits & num2.bits) << 1;
31+
--- ./tests/i32_tests.move
32+
+++ ./tests/i32_tests.move
33+
@@ -733 +733 @@
34+
- let i = mod(neg_from(2), from(5));
35+
+ let mut i = mod(neg_from(2), from(5));
36+
--- ./tests/i64_tests.move
37+
+++ ./tests/i64_tests.move
38+
@@ -622 +622 @@
39+
- let i = mod(neg_from(2), from(5));
40+
+ let mut i = mod(neg_from(2), from(5));

sui/sources/i128.move

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module integer_mate::i128 {
1111
const EQ: u8 = 1;
1212
const GT: u8 = 2;
1313

14-
struct I128 has copy, drop, store {
14+
public struct I128 has copy, drop, store {
1515
bits: u128
1616
}
1717

@@ -50,8 +50,8 @@ module integer_mate::i128 {
5050
}
5151

5252
public fun wrapping_add(num1: I128, num2:I128): I128 {
53-
let sum = num1.bits ^ num2.bits;
54-
let carry = (num1.bits & num2.bits) << 1;
53+
let mut sum = num1.bits ^ num2.bits;
54+
let mut carry = (num1.bits & num2.bits) << 1;
5555
while (carry != 0) {
5656
let a = sum;
5757
let b = carry;

sui/sources/i32.move

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module integer_mate::i32 {
88
const EQ: u8 = 1;
99
const GT: u8 = 2;
1010

11-
struct I32 has copy, drop, store {
11+
public struct I32 has copy, drop, store {
1212
bits: u32
1313
}
1414

@@ -45,8 +45,8 @@ module integer_mate::i32 {
4545
}
4646

4747
public fun wrapping_add(num1: I32, num2: I32): I32 {
48-
let sum = num1.bits ^ num2.bits;
49-
let carry = (num1.bits & num2.bits) << 1;
48+
let mut sum = num1.bits ^ num2.bits;
49+
let mut carry = (num1.bits & num2.bits) << 1;
5050
while (carry != 0) {
5151
let a = sum;
5252
let b = carry;

sui/sources/i64.move

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module integer_mate::i64 {
88
const EQ: u8 = 1;
99
const GT: u8 = 2;
1010

11-
struct I64 has copy, drop, store {
11+
public struct I64 has copy, drop, store {
1212
bits: u64
1313
}
1414

@@ -45,8 +45,8 @@ module integer_mate::i64 {
4545
}
4646

4747
public fun wrapping_add(num1: I64, num2: I64): I64 {
48-
let sum = num1.bits ^ num2.bits;
49-
let carry = (num1.bits & num2.bits) << 1;
48+
let mut sum = num1.bits ^ num2.bits;
49+
let mut carry = (num1.bits & num2.bits) << 1;
5050
while (carry != 0) {
5151
let a = sum;
5252
let b = carry;

sui/tests/i32_tests.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ module integer_mate::i32_tests {
730730
#[test]
731731
fun test_mod() {
732732
//use aptos_std::debug;
733-
let i = mod(neg_from(2), from(5));
733+
let mut i = mod(neg_from(2), from(5));
734734
assert!(cmp(i, neg_from(2)) == EQ, 0);
735735

736736
i = mod(neg_from(2), neg_from(5));

sui/tests/i64_tests.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ module integer_mate::i64_tests {
619619
#[test]
620620
fun test_mod() {
621621
//use aptos_std::debug;
622-
let i = mod(neg_from(2), from(5));
622+
let mut i = mod(neg_from(2), from(5));
623623
assert!(cmp(i, neg_from(2)) == EQ, 0);
624624

625625
i = mod(neg_from(2), neg_from(5));

0 commit comments

Comments
 (0)