Skip to content

Commit

Permalink
[compiler-v2] fixed move warning (#4219)
Browse files Browse the repository at this point in the history
  • Loading branch information
welbon authored Sep 29, 2024
1 parent 8e44cfb commit a8f9ce5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions vm/framework/starcoin-stdlib/doc/pool_u64.md
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ Return the number of coins <code>shares</code> are worth in <code>self</code> wi



<pre><code><b>public</b> <b>fun</b> <a href="pool_u64.md#0x1_pool_u64_multiply_then_divide">multiply_then_divide</a>(self: &<a href="pool_u64.md#0x1_pool_u64_Pool">pool_u64::Pool</a>, x: u64, y: u64, z: u64): u64
<pre><code><b>public</b> <b>fun</b> <a href="pool_u64.md#0x1_pool_u64_multiply_then_divide">multiply_then_divide</a>(_self: &<a href="pool_u64.md#0x1_pool_u64_Pool">pool_u64::Pool</a>, x: u64, y: u64, z: u64): u64
</code></pre>


Expand All @@ -854,7 +854,7 @@ Return the number of coins <code>shares</code> are worth in <code>self</code> wi
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="pool_u64.md#0x1_pool_u64_multiply_then_divide">multiply_then_divide</a>(self: &<a href="pool_u64.md#0x1_pool_u64_Pool">Pool</a>, x: u64, y: u64, z: u64): u64 {
<pre><code><b>public</b> <b>fun</b> <a href="pool_u64.md#0x1_pool_u64_multiply_then_divide">multiply_then_divide</a>(_self: &<a href="pool_u64.md#0x1_pool_u64_Pool">Pool</a>, x: u64, y: u64, z: u64): u64 {
<b>let</b> result = (<a href="pool_u64.md#0x1_pool_u64_to_u128">to_u128</a>(x) * <a href="pool_u64.md#0x1_pool_u64_to_u128">to_u128</a>(y)) / <a href="pool_u64.md#0x1_pool_u64_to_u128">to_u128</a>(z);
(result <b>as</b> u64)
}
Expand Down Expand Up @@ -1277,7 +1277,7 @@ Return the number of coins <code>shares</code> are worth in <code>self</code> wi
### Function `multiply_then_divide`


<pre><code><b>public</b> <b>fun</b> <a href="pool_u64.md#0x1_pool_u64_multiply_then_divide">multiply_then_divide</a>(self: &<a href="pool_u64.md#0x1_pool_u64_Pool">pool_u64::Pool</a>, x: u64, y: u64, z: u64): u64
<pre><code><b>public</b> <b>fun</b> <a href="pool_u64.md#0x1_pool_u64_multiply_then_divide">multiply_then_divide</a>(_self: &<a href="pool_u64.md#0x1_pool_u64_Pool">pool_u64::Pool</a>, x: u64, y: u64, z: u64): u64
</code></pre>


Expand Down
6 changes: 3 additions & 3 deletions vm/framework/starcoin-stdlib/doc/pool_u64_unbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ Return the number of coins <code>shares</code> are worth in <code>pool</code> wi



<pre><code><b>public</b> <b>fun</b> <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_multiply_then_divide">multiply_then_divide</a>(self: &<a href="pool_u64_unbound.md#0x1_pool_u64_unbound_Pool">pool_u64_unbound::Pool</a>, x: u128, y: u128, z: u128): u128
<pre><code><b>public</b> <b>fun</b> <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_multiply_then_divide">multiply_then_divide</a>(_self: &<a href="pool_u64_unbound.md#0x1_pool_u64_unbound_Pool">pool_u64_unbound::Pool</a>, x: u128, y: u128, z: u128): u128
</code></pre>


Expand All @@ -851,7 +851,7 @@ Return the number of coins <code>shares</code> are worth in <code>pool</code> wi
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_multiply_then_divide">multiply_then_divide</a>(self: &<a href="pool_u64_unbound.md#0x1_pool_u64_unbound_Pool">Pool</a>, x: u128, y: u128, z: u128): u128 {
<pre><code><b>public</b> <b>fun</b> <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_multiply_then_divide">multiply_then_divide</a>(_self: &<a href="pool_u64_unbound.md#0x1_pool_u64_unbound_Pool">Pool</a>, x: u128, y: u128, z: u128): u128 {
<b>let</b> result = (<a href="pool_u64_unbound.md#0x1_pool_u64_unbound_to_u256">to_u256</a>(x) * <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_to_u256">to_u256</a>(y)) / <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_to_u256">to_u256</a>(z);
(result <b>as</b> u128)
}
Expand Down Expand Up @@ -1287,7 +1287,7 @@ Return the number of coins <code>shares</code> are worth in <code>pool</code> wi
### Function `multiply_then_divide`


<pre><code><b>public</b> <b>fun</b> <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_multiply_then_divide">multiply_then_divide</a>(self: &<a href="pool_u64_unbound.md#0x1_pool_u64_unbound_Pool">pool_u64_unbound::Pool</a>, x: u128, y: u128, z: u128): u128
<pre><code><b>public</b> <b>fun</b> <a href="pool_u64_unbound.md#0x1_pool_u64_unbound_multiply_then_divide">multiply_then_divide</a>(_self: &<a href="pool_u64_unbound.md#0x1_pool_u64_unbound_Pool">pool_u64_unbound::Pool</a>, x: u128, y: u128, z: u128): u128
</code></pre>


Expand Down
2 changes: 1 addition & 1 deletion vm/framework/starcoin-stdlib/sources/pool_u64.move
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ module starcoin_std::pool_u64 {
}
}

public fun multiply_then_divide(self: &Pool, x: u64, y: u64, z: u64): u64 {
public fun multiply_then_divide(_self: &Pool, x: u64, y: u64, z: u64): u64 {
let result = (to_u128(x) * to_u128(y)) / to_u128(z);
(result as u64)
}
Expand Down
2 changes: 1 addition & 1 deletion vm/framework/starcoin-stdlib/sources/pool_u64.spec.move
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ spec starcoin_std::pool_u64 {
}
}

spec multiply_then_divide(self: &Pool, x: u64, y: u64, z: u64): u64 {
spec multiply_then_divide(_self: &Pool, x: u64, y: u64, z: u64): u64 {
aborts_if z == 0;
aborts_if (x * y) / z > MAX_U64;
ensures result == (x * y) / z;
Expand Down
2 changes: 1 addition & 1 deletion vm/framework/starcoin-stdlib/sources/pool_u64_unbound.move
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ module starcoin_std::pool_u64_unbound {
}
}

public fun multiply_then_divide(self: &Pool, x: u128, y: u128, z: u128): u128 {
public fun multiply_then_divide(_self: &Pool, x: u128, y: u128, z: u128): u128 {
let result = (to_u256(x) * to_u256(y)) / to_u256(z);
(result as u128)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec starcoin_std::pool_u64_unbound {
}
}

spec multiply_then_divide(self: &Pool, x: u128, y: u128, z: u128): u128 {
spec multiply_then_divide(_self: &Pool, x: u128, y: u128, z: u128): u128 {
aborts_if z == 0;
aborts_if (x * y) / z > MAX_U128;
ensures result == (x * y) / z;
Expand Down

0 comments on commit a8f9ce5

Please sign in to comment.