Skip to content

Commit

Permalink
adds documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sveamarcus committed Oct 25, 2023
1 parent 0b33db0 commit 98d3537
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/math/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,21 @@ impl U256BitShift of BitShift<u256> {
}
}

/// Rotate the bits of an unsigned integer of type T
trait BitRotate<T> {
/// Take the bits of an unsigned integer and rotate in the left direction
/// # Arguments
/// * `x` - rotate its bit representation in the leftward direction
/// * `n` - number of steps to rotate
/// # Returns
/// * `T` - the result of rotating the bits of number `x` left, `n` number of steps
fn rotl(x: T, n: T) -> T;
/// Take the bits of an unsigned integer and rotate in the right direction
/// # Arguments
/// * `x` - rotate its bit representation in the rightward direction
/// * `n` - number of steps to rotate
/// # Returns
/// * `T` - the result of rotating the bits of number `x` right, `n` number of steps
fn rotr(x: T, n: T) -> T;
}

Expand Down

0 comments on commit 98d3537

Please sign in to comment.