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

Free memory pointer #169

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions precompiles/Modexp.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ object "ModExp" {
object "ModExp_deployed" {
code {


fkrause98 marked this conversation as resolved.
Show resolved Hide resolved
// CONSTANTS
function LIMB_SIZE_IN_BYTES() -> limbSize {
limbSize := 0x20
Expand All @@ -13,6 +14,14 @@ object "ModExp" {
}
// HELPER FUNCTIONS

/// @notice Returns an address for a free memory region,
/// which will be startPtr...(startPtr+(howManyAdresses*32))
/// @param howManyAdresses The number of addresses needed.
function freeMemoryPointer(howManyAdresses) -> startPtr {
startPtr := mload(0x0)
mstore(0x0, add(startPtr, mul(howManyAdresses, 32)))
fkrause98 marked this conversation as resolved.
Show resolved Hide resolved
}

/// @notice Stores a one in big unsigned integer form in memory.
/// @param nLimbs The number of limbs needed to represent the operand.
/// @param toAddress The pointer to the MSB of the destination.
Expand Down