Skip to content

Commit

Permalink
add some function in Compare (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
WGB5445 authored and sanlee42 committed Mar 16, 2023
1 parent 65733b2 commit 7327c12
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
Binary file modified build/StarcoinFramework/bytecode_modules/Compare.mv
Binary file not shown.
111 changes: 111 additions & 0 deletions build/StarcoinFramework/docs/Compare.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
- [Function `cmp_bytes`](#0x1_Compare_cmp_bytes)
- [Function `cmp_u8`](#0x1_Compare_cmp_u8)
- [Function `cmp_u64`](#0x1_Compare_cmp_u64)
- [Function `is_equal`](#0x1_Compare_is_equal)
- [Function `is_less_than`](#0x1_Compare_is_less_than)
- [Function `is_greater_than`](#0x1_Compare_is_greater_than)
- [Module Specification](#@Module_Specification_1)


Expand Down Expand Up @@ -250,6 +253,114 @@ Keep this in mind when using this function to compare addresses.



</details>

<a name="0x1_Compare_is_equal"></a>

## Function `is_equal`



<pre><code><b>public</b> <b>fun</b> <a href="Compare.md#0x1_Compare_is_equal">is_equal</a>(result: u8): bool
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Compare.md#0x1_Compare_is_equal">is_equal</a>(result: u8): bool {
result == <a href="Compare.md#0x1_Compare_EQUAL">EQUAL</a>
}
</code></pre>



</details>

<details>
<summary>Specification</summary>



<pre><code><b>aborts_if</b> <b>false</b>;
</code></pre>



</details>

<a name="0x1_Compare_is_less_than"></a>

## Function `is_less_than`



<pre><code><b>public</b> <b>fun</b> <a href="Compare.md#0x1_Compare_is_less_than">is_less_than</a>(result: u8): bool
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Compare.md#0x1_Compare_is_less_than">is_less_than</a>(result: u8): bool {
result == <a href="Compare.md#0x1_Compare_LESS_THAN">LESS_THAN</a>
}
</code></pre>



</details>

<details>
<summary>Specification</summary>



<pre><code><b>aborts_if</b> <b>false</b>;
</code></pre>



</details>

<a name="0x1_Compare_is_greater_than"></a>

## Function `is_greater_than`



<pre><code><b>public</b> <b>fun</b> <a href="Compare.md#0x1_Compare_is_greater_than">is_greater_than</a>(result: u8): bool
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="Compare.md#0x1_Compare_is_greater_than">is_greater_than</a>(result: u8): bool {
result == <a href="Compare.md#0x1_Compare_GREATER_THAN">GREATER_THAN</a>
}
</code></pre>



</details>

<details>
<summary>Specification</summary>



<pre><code><b>aborts_if</b> <b>false</b>;
</code></pre>



</details>

<a name="@Module_Specification_1"></a>
Expand Down
Binary file modified build/StarcoinFramework/source_maps/Compare.mvsm
Binary file not shown.
23 changes: 23 additions & 0 deletions sources/Compare.move
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ module Compare {
aborts_if false;
}

public fun is_equal(result: u8): bool {
result == EQUAL
}

spec is_equal {
aborts_if false;
}

public fun is_less_than(result: u8): bool {
result == LESS_THAN
}

spec is_less_than {
aborts_if false;
}

public fun is_greater_than(result: u8): bool {
result == GREATER_THAN
}

spec is_greater_than {
aborts_if false;
}
}

}

0 comments on commit 7327c12

Please sign in to comment.