Skip to content

Commit

Permalink
Merge pull request #459 from kaola526/master
Browse files Browse the repository at this point in the history
Update issues in the documentation
  • Loading branch information
d0cd authored Feb 18, 2025
2 parents a5c734f + a33a7e8 commit 554c20c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions documentation/aleo/03_language.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ A struct is a data type declared as `struct {name}:`.
Structs contain component declarations `{name} as {type}`.

```aleo showLineNumbers
struct array3:
struct rgb:
a0 as u32;
a1 as u32;
a2 as u32;
Expand All @@ -247,11 +247,11 @@ struct array3:
To instantiate a `struct` in a program use the `cast` instruction.

```aleo showLineNumbers
function new_array3:
function new_rgb:
input r0 as u32.private;
input r1 as u32.private;
input r2 as u32.private;
cast r0 r1 r2 into r3 as array3;
cast r0 r1 r2 into r3 as rgb;
output r3;
```

Expand Down
17 changes: 8 additions & 9 deletions documentation/aleo/04_opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ The following lists show the standard and cryptographic opcodes supported by Ale
| [nor](#nor) | `Boolean` NOR operation |
| [not](#not) | NOT operation |
| [or](#or) | OR Operation |
| [position](#position) | The position command |
| [position](#position) | Mark a possible branch target |
| [pow](#pow) | Exponentiation operation |
| [pow.w](#poww) | Wrapping exponentiation operation |
| [rand.chacha](#randchacha) | Generates a random value within the `finalize` scope. |
| [rand.chacha](#randchacha) | Generates a random value |
| [rem](#rem) | Remainder operation |
| [rem.w](#remw) | Wrapping remainder operation |
| [shl](#shl) | Shift left operation |
Expand Down Expand Up @@ -94,7 +94,7 @@ The following is the specification for each opcode in the Aleo Virtual Machine (

Computes the absolute value of the input, checking for overflow, storing the result in the destination register.

For integer types, a constraint is added to check for underflow. For cases where wrapping semantics are needed, see the [abs.w](#abs.w) instruction. This underflow happens when the input is the minimum value of a signed integer type. For example, `abs -128i8` would result in underflow, since `128` cannot be represented as an `i8`.
For integer types, a constraint is added to check for overflow. For cases where wrapping semantics are needed, see the [abs.w](#abs.w) instruction. This overflow happens when the input is the minimum value of a signed integer type. For example, `abs -128i8` would result in overflow, since `128` cannot be represented as an `i8`.

#### Supported Types

Expand All @@ -114,7 +114,7 @@ For integer types, a constraint is added to check for underflow. For cases where

#### Description

Compute the absolute value of the input, wrapping around at the boundary of the type, and storing the result in the destination register.
Compute the absolute value of the input, wrapping around at the boundary of the type, and storing the result in the destination register. `abs.w -128i8` executes normally, the result is 0 (`abs -128i8` run was interrupted).

#### Supported Types

Expand Down Expand Up @@ -1771,13 +1771,13 @@ Shifts `first` right by `second` bits, wrapping around at the boundary of the ty

***

### `square`
### `sqrt`

[Back to Top](#table-of-standard-opcodes)

#### Description

Squares the input, storing the outcome in `destination`.
Computes the square root of the input, storing the outcome in `destination`.

#### Supported Types

Expand All @@ -1787,13 +1787,13 @@ Squares the input, storing the outcome in `destination`.

***

### `sqrt`
### `square`

[Back to Top](#table-of-standard-opcodes)

#### Description

Computes the square root of the input, storing the outcome in `destination`.
Squares the input, storing the outcome in `destination`.

#### Supported Types

Expand All @@ -1803,7 +1803,6 @@ Computes the square root of the input, storing the outcome in `destination`.

***


### `sub`

[Back to Top](#table-of-standard-opcodes)
Expand Down
6 changes: 3 additions & 3 deletions documentation/leo/04_operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -1878,15 +1878,15 @@ let result: u128 = Keccak384::hash_to_u128(1field);

#### Description

Computes a Keccak384 hash on inputs of 256-bit chunks in `first`, storing the hash in `destination`.
Computes a Keccak384 hash on inputs of 384-bit chunks in `first`, storing the hash in `destination`.
The produced hash will always be an arithmetic (`u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`,`i64`,`i128`, `field`, `group`, or `scalar`) or `address` value, as specified via `hash_to_DESTINATION` at the end of the function.

#### Supported Types

| First | Destination |
|-----------|:----------------------------------------------------------------------------------------------------------|
| `address` | `address`, `field`, `group`, `scalar`, `i8`, `i16`, `i32`,`i64`,`i128`, `u8`, `u16`, `u32`, `u64`, `u128` |
| `bool` | `address`, `field`, `group`, `scalar`, `i8`, `i16`, `i32`,`i64`,`i128`, `u8`, `u16`, `u32`, `u64`, `u128` |
| `bool` | `address`, `field`, `group`, `scalar`, `i8`, `i16`, `i32`,`i64`,`i128`, `u8`, `u16`, `u32`, `u64`, `u128` |
| `field` | `address`, `field`, `group`, `scalar`, `i8`, `i16`, `i32`,`i64`,`i128`, `u8`, `u16`, `u32`, `u64`, `u128` |
| `group` | `address`, `field`, `group`, `scalar`, `i8`, `i16`, `i32`,`i64`,`i128`, `u8`, `u16`, `u32`, `u64`, `u128` |
| `i8` | `address`, `field`, `group`, `scalar`, `i8`, `i16`, `i32`,`i64`,`i128`, `u8`, `u16`, `u32`, `u64`, `u128` |
Expand Down Expand Up @@ -1926,7 +1926,7 @@ let result: u128 = Keccak512::hash_to_u128(1field);

#### Description

Computes a Keccak512 hash on inputs of 256-bit chunks in `first`, storing the hash in `destination`.
Computes a Keccak512 hash on inputs of 512-bit chunks in `first`, storing the hash in `destination`.
The produced hash will always be an arithmetic (`u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`,`i64`,`i128`, `field`, `group`, or `scalar`) or `address` value, as specified via `hash_to_DESTINATION` at the end of the function.

#### Supported Types
Expand Down

0 comments on commit 554c20c

Please sign in to comment.