Example #1
0
/**
 * initializes the sieve global variables
 */
void init_sieve_globals() {

  mpz_init(mpz_fixed_hash_multiplier);
  mpz_set(mpz_fixed_hash_multiplier, opts.mpz_fixed_hash_multiplier);

  int64_arithmetic     = opts.int64_arithmetic;
  min_prime_index      = opts.primes_in_primorial; 
  pool_share           = opts.pool_share;
  primes               = opts.primes->ptr;
  two_inverses         = opts.two_inverses;
  chain_length         = opts.chain_length;
  extensions           = opts.sieve_extensions;
  use_first_half       = opts.use_first_half;
  layers               = extensions + chain_length;
  max_prime_index      = opts.max_prime_index;
  cache_bits           = opts.cache_bits;
  sieve_words          = opts.sieve_words;
  sieve_size           = opts.sieve_size;
  candidate_bytes      = sizeof(sieve_t) * sieve_words;
  bit_half             = sieve_size  / 2;
  word_half            = sieve_words / 2;
  cache_words          = word_index(cache_bits);
  cache_bytes          = byte_index(cache_bits); 

  /* calculate the bi-twin cc1 and cc2 layers */
  twn_cc1_layers = (chain_length + 1) / 2 - 1;
  twn_cc2_layers = chain_length       / 2 - 1;


  /* check the primes if DEBUG is enabled */
  check_primes(primes, two_inverses, max_prime_index);
}
Example #2
0
 /* Return first index of the byte at which this column is stored */
 snp_int_t get_first_byte_in_column (const snp_int_t& column) const {
   return byte_index(0,column);
 }