Skip to content

Commit 68180e2

Browse files
authored
Added from_u128 method to I128 module (#2)
* added from_u128 method * updated pkg published at
1 parent d8ebf52 commit 68180e2

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
/sui/build
44
/build
55
/.idea
6+
node_modules
7+
/.vscode
8+
/.DS_Store
9+
/.env

Move.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[move]
44
version = 3
5-
manifest_digest = "1B29C0E9894E300594C1632826C95D54D7F9CF16F611403E8C9141E0932A3F21"
5+
manifest_digest = "1E8F3549DA1BE16C1C23F67C000E57C788A42529397330E9A15349D7D07E18CA"
66
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
77
dependencies = [
88
{ id = "Sui", name = "Sui" },

Move.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[package]
44
name = "IntegerLibrary"
55
version = "1.0.0"
6-
published-at = "0x03637b7b60978ef4389124f7683456f0050ab015a0590d52b6e6cadb342af34a"
6+
published-at = "0x7ed928033044a2065decf7135c8291d0a42ae3e4e481c61200e79f6e17f3038b"
77

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

sources/i128.move

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ module integer_library::i128 {
2828
}
2929
}
3030

31+
public fun from_u128(v: u128): I128 {
32+
I128 {
33+
bits: v
34+
}
35+
}
36+
3137
public fun neg_from(v: u128): I128 {
3238
assert!(v <= MIN_AS_U128, EOverflow);
3339
if (v == 0) {

0 commit comments

Comments
 (0)