MCPcopy Create free account
hub / github.com/albertobsd/keyhunt / bsgs_heapify

Function bsgs_heapify

keyhunt.cpp:3723–3735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3721}
3722
3723void bsgs_heapify(struct bsgs_xvalue *arr, int64_t n, int64_t i) {
3724 int64_t largest = i;
3725 int64_t l = 2 * i + 1;
3726 int64_t r = 2 * i + 2;
3727 if (l < n && memcmp(arr[l].value,arr[largest].value,BSGS_XVALUE_RAM) > 0)
3728 largest = l;
3729 if (r < n && memcmp(arr[r].value,arr[largest].value,BSGS_XVALUE_RAM) > 0)
3730 largest = r;
3731 if (largest != i) {
3732 bsgs_swap(&arr[i],&arr[largest]);
3733 bsgs_heapify(arr, n, largest);
3734 }
3735}
3736
3737void bsgs_myheapsort(struct bsgs_xvalue *arr, int64_t n) {
3738 int64_t i;

Callers 1

bsgs_myheapsortFunction · 0.70

Calls 1

bsgs_swapFunction · 0.70

Tested by

no test coverage detected