Skip to content

Instantly share code, notes, and snippets.

View ARR4N's full-sized avatar

Arran Schlosberg ARR4N

View GitHub Profile
@highskore
highskore / Quicksort.huff
Last active August 6, 2024 20:28
Recursive QuickSort in Huff
/// @notice Sort
/// @notice Loads the unsorted array from calldata and returns the sorted array
#define macro SORT() = takes (0) returns (0) {
// copy array from calldata to memory
0x24 calldataload // [array_length]
0x20 // [0x20, array_length]
mul // [32 * array_length]
0x44 // [0x44, 32 * array_length]
0x00 // [0x00, 0x44, 32 * array_length]
calldatacopy