/* Copyright (C) 2022 Stephen Hewitt, cambridgeclarion.org This file is part of a programme to research fast Fermat factorisation algorithms. This is free software: you can redistribute it and/or modify it under the terms of version 3 of the GNU General Public License as published by the Free Software Foundation. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public Licence along with this programme. If not, see . A copy of the licence is also available at https://www.cambridgeclarion.org/download/GPLv3.txt It has the following cryptographic hash SHA256 3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986 */ class Squares { std::vector square_table; const unsigned long M; unsigned long max_skip; public: Squares(unsigned long M); unsigned char const *valid_squares() { return square_table.data(); } }; typedef uint16_t Skint; // skip integer type used in filter table, probably should be a member of Filter class Filter { std::vector skip; const unsigned skip_n; const unsigned long M; unsigned long smallest_candidate; unsigned long max_skip; public: Filter(unsigned long M, unsigned skip_n, unsigned long NmodM, const unsigned char* const valid_squares); inline unsigned get_skip(unsigned entry) { return skip[entry]; } unsigned long get_offset_to_next(unsigned& skindex, unsigned long guess_modM); Skint* get_table() { return skip.data(); } unsigned long get_max_skip () { return max_skip;} }; unsigned calc_tr(unsigned long M, unsigned long NmodM, const unsigned char* const valid_squares);