Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add some func in Compare #180

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}

}