7#include "../../../include/lammp/impl/ele_mul.h"
8#include "../../../include/lammp/impl/mparam.h"
18 size_t parent = (index - 1) / 2;
21 while (index > 0 && pq->head[index].n < pq->head[parent].n) {
24 parent = (index - 1) / 2;
36 size_t smallest = index;
37 size_t left = 2 * index + 1;
38 size_t right = 2 * index + 2;
40 if (left < pq->size && pq->head[left].n < pq->head[smallest].n) {
43 if (right < pq->size && pq->head[right].n < pq->head[smallest].n) {
47 if (smallest == index) {
58 pq->head[pq->size].num = elem;
59 pq->head[pq->size].n = n;
70 *outElem = pq->head[0];
71 pq->head[0] = pq->head[pq->size - 1];
94 numa.
n -= numa.
num[numa.
n - 1] == 0 ? 1 : 0;
109 rn -= dst[rn - 1] == 0 ? 1 : 0;
121 n -= dst[n - 1] == 0 ? 1 : 0;
static void heapifyDown(num_heap *restrict pq, size_t index)
static void swap_num_node(num_node_ptr restrict a, num_node_ptr restrict b)
void lmmp_num_heap_push_(num_heap *restrict pq, mp_ptr elem, mp_size_t n)
bool lmmp_num_heap_pop_(num_heap *restrict pq, num_node_ptr restrict outElem)
mp_ptr lmmp_num_heap_mul_(num_heap *restrict pq, mp_size_t *restrict rn)
mp_size_t lmmp_elem_mul_ulong_(mp_ptr restrict dst, const ulongp restrict limbs, mp_size_t n, mp_ptr restrict tp)
static void heapifyUp(num_heap *restrict pq, size_t index)
#define lmmp_debug_assert(x)
void lmmp_free(void *ptr)
内存释放函数(调用lmmp_heap_free_fn)
#define lmmp_param_assert(x)
void lmmp_mul_(mp_ptr dst, mp_srcptr numa, mp_size_t na, mp_srcptr numb, mp_size_t nb)
不等长大数乘法操作 [dst,na+nb] = [numa,na] * [numb,nb]
mp_limb_t lmmp_mul_1_(mp_ptr dst, mp_srcptr numa, mp_size_t na, mp_limb_t x)
大数乘以单limb操作 [dst,na] = [numa,na] * x
#define ELEM_MUL_BASECASE_THRESHOLD
#define ALLOC_TYPE(n, type)