summaryrefslogblamecommitdiffstats
path: root/mpz.h
blob: ef41ec6b90ce2c811a51cec4d8f8e148175a6a7b (plain) (tree)





















                                                                                    
#pragma once

#include <gmp.h>
#include <stddef.h>

/* This struct contains the instance data used by the iterators.  Allocation is
 * performed at a single point to reduce run-time overhead.
 *
 * 'current' contains the iterator's current value.  The rest of the members are
 * temporary variables.  See the appropriate memory management functions for
 * this type. */
struct pszip_mpz_state
{
    mpz_t current, a, b, c, d;
};

void pszip_mpz_state_init(struct pszip_mpz_state *mpzs, size_t popcnt, size_t size);
void pszip_mpz_state_clear(struct pszip_mpz_state *mpzs);
void pszip_mpz_init_data(mpz_t n, const void *data, size_t size);

void pszip_mpz_iterate_bithack01(struct pszip_mpz_state *mpzs);
void pszip_mpz_iterate_bithack02(struct pszip_mpz_state *mpzs);