Skip to content

Commit

Permalink
fix: typos (#194)
Browse files Browse the repository at this point in the history
<!--- Please provide a general summary of your changes in the title
above -->

## Pull Request type

<!-- Please try to limit your pull request to one type; submit multiple
pull requests if needed. -->

- [x] Typos

## Does this introduce a breaking change?

- [ ] Yes
- [x] No
  • Loading branch information
omahs authored Oct 17, 2023
1 parent 978090c commit 4dfa428
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/ascii/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# ASCII

## Interger
## Integer

1. Split Intergers into an array of its individual ascii values
1. Split Integers into an array of its individual ascii values

> 123 -> [49,50,51]
2. Converts Intergers into a string represented as either a single felt252 or if it exceeds 31 chars an array of felt252
2. Converts Integers into a string represented as either a single felt252 or if it exceeds 31 chars an array of felt252

> 123 -> "123
24 changes: 12 additions & 12 deletions src/ascii/src/interger.cairo → src/ascii/src/integer.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ trait ToAsciiTrait<T, U> {
fn to_ascii(self: T) -> U;
}

// converts intergers into an array of its individual ascii values
// converts integers into an array of its individual ascii values
trait ToAsciiArrayTrait<T> {
fn to_ascii_array(self: T) -> Array<felt252>;
fn to_inverse_ascii_array(self: T) -> Array<felt252>;
}

// converts intergers into an array of its individual ascii values
// converts integers into an array of its individual ascii values
// e.g. 123 -> [49, 50, 51]
impl ToAsciiArrayTraitImpl<
T,
Expand Down Expand Up @@ -54,10 +54,10 @@ impl ToAsciiArrayTraitImpl<
}
}

// gneric implementation for small intergers <u128
// to transform its intergers into a string represented as a single felt252
// generic implementation for small integers <u128
// to transform its integers into a string represented as a single felt252
// e.g. 1000 -> "1000"
impl SmallIntergerToAsciiTraitImpl<
impl SmallIntegerToAsciiTraitImpl<
T,
impl TPartialOrd: PartialOrd<T>,
impl TDivRem: DivRem<T>,
Expand Down Expand Up @@ -86,10 +86,10 @@ impl SmallIntergerToAsciiTraitImpl<
}
}

// gneric implementation for big intergers u128
// to transform its intergers into a string represented as multiple felt252 if there is overflow
// generic implementation for big integers u128
// to transform its integers into a string represented as multiple felt252 if there is overflow
// e.g. max_num + 123 -> ["max_num", "123"]
impl BigIntergerToAsciiTraitImpl<
impl BigIntegerToAsciiTraitImpl<
T,
impl TPartialOrd: PartialOrd<T>,
impl TDivRem: DivRem<T>,
Expand Down Expand Up @@ -125,7 +125,7 @@ impl BigIntergerToAsciiTraitImpl<
},
Option::None(_) => {
// if ascii is 0 it means we have already appended the first ascii
// and theres no need to append it again
// and there's no need to append it again
if ascii.is_non_zero() {
data.append(ascii);
}
Expand All @@ -141,8 +141,8 @@ impl BigIntergerToAsciiTraitImpl<
// -------------------------------------------------------------------------- //
// for u256 //
// -------------------------------------------------------------------------- //
// have to implement seperately for u256 because
// it dosent have the same implementations as the generic version
// have to implement separately for u256 because
// it doesn't have the same implementations as the generic version
impl U256ToAsciiArrayTraitImpl of ToAsciiArrayTrait<u256> {
fn to_ascii_array(self: u256) -> Array<felt252> {
let mut new_arr = self.to_inverse_ascii_array();
Expand Down Expand Up @@ -200,7 +200,7 @@ impl U256ToAsciiTraitImpl of ToAsciiTrait<u256, Array<felt252>> {
},
Option::None(_) => {
// if ascii is 0 it means we have already appended the first ascii
// and theres no need to append it again
// and there's no need to append it again
if ascii.is_non_zero() {
data.append(ascii);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ascii/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod interger;
use interger::{ToAsciiTrait, ToAsciiArrayTrait};
mod integer;
use integer::{ToAsciiTrait, ToAsciiArrayTrait};

#[cfg(test)]
mod tests;
2 changes: 1 addition & 1 deletion src/ascii/src/tests.cairo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod test_ascii_interger;
mod test_ascii_integer;
8 changes: 4 additions & 4 deletions src/bytes/src/bytes.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ const BYTES_PER_ELEMENT: usize = 16;
/// Bytes is a cairo implementation of solidity Bytes in Big-endian.
/// It is a dynamic array of u128, where each element contains 16 bytes.
/// To save cost, the last element MUST be filled fully.
/// That's means that every element should and MUST contains 16 bytes.
/// That means that every element should and MUST contain 16 bytes.
/// For example, if we have a Bytes with 33 bytes, we will have 3 elements.
/// Theroetically, the bytes looks like this:
/// Theoretically, the bytes look like this:
/// first element: [16 bytes]
/// second element: [16 bytes]
/// third element: [1 byte]
/// But in alexandria bytes, the last element should be padded with zero to make
/// it 16 bytes. So the alexandria bytes looks like this:
/// it 16 bytes. So the alexandria bytes look like this:
/// first element: [16 bytes]
/// second element: [16 bytes]
/// third element: [1 byte] + [15 bytes zero padding]
Expand Down Expand Up @@ -508,7 +508,7 @@ impl BytesImpl of BytesTrait {
return keccak_u128s_be(self.data.span(), self.size());
} else {
let mut hash_data = u128_array_slice(self.data, 0, last_data_index);
// To cumpute hash, we should remove 0 padded
// To compute hash, we should remove 0 padded
let (last_element_value, _) = u128_split(
*self.data[last_data_index], BYTES_PER_ELEMENT, last_element_size
);
Expand Down

0 comments on commit 4dfa428

Please sign in to comment.