Remove dependency on GMP, so that it is easier to run the bench suite.

This commit is contained in:
Patrick Pelissier committed 2018-03-29 20:01:45 +02:00
1 parent 18710567f2
commit bc83fe43e5
9 files changed
+142 -74

No files matched your search

+8 -8
View File
@@ -20,17 +20,17 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <gmp.h>
#include <assert.h>
#include "mympz.h"
#include "m-shared.h"
#include "coverage.h"
START_COVERAGE
SHARED_PTR_DEF(shared_int, int)
SHARED_RESOURCE_DEF(shared_ressource, mpz_t, M_CLASSIC_OPLIST(mpz))
SHARED_RESOURCE_DEF(shared_ressource, my_mpz_t, M_CLASSIC_OPLIST(my_mpz))
END_COVERAGE
SHARED_PTR_DEF(shared_mpz, mpz_t, M_CLASSIC_OPLIST(mpz))
SHARED_PTR_DEF(shared_mpz, my_mpz_t, M_CLASSIC_OPLIST(my_mpz))
SHARED_PTR_RELAXED_DEF(shared_relaxed_int, int)
static int f(const shared_int_t p)
@@ -143,18 +143,18 @@ static void test_ressource(int n)
for(int i = 0; i < n ; i++) {
shared_ressource_it (it[i], ressource);
assert (!shared_ressource_end_p(it[i]));
mpz_t *z = shared_ressource_ref(it[i]);
my_mpz_t *z = shared_ressource_ref(it[i]);
assert (z != NULL);
mpz_set_ui(*z, i);
my_mpz_set_ui(*z, i);
}
shared_ressource_it (onemore, ressource);
assert (shared_ressource_end_p(onemore));
for(int i = 0; i < n ; i++) {
shared_ressource_it_set (copy[i], it[i]);
assert (!shared_ressource_end_p(copy[i]));
const mpz_t *z = shared_ressource_cref(copy[i]);
const my_mpz_t *z = shared_ressource_cref(copy[i]);
assert (z != NULL);
assert (mpz_cmp_ui(*z, i) == 0);
assert (my_mpz_cmp_ui(*z, i) == 0);
}
shared_ressource_it (onemore, ressource);
assert (shared_ressource_end_p(onemore));
@@ -164,7 +164,7 @@ static void test_ressource(int n)
shared_ressource_it (onemore, ressource);
assert (shared_ressource_end_p(onemore));
for(int i = n-1; i >= 0 ; i--) {
const mpz_t *z = shared_ressource_cref(copy[i]);
const my_mpz_t *z = shared_ressource_cref(copy[i]);
assert (z != NULL);
shared_ressource_end (copy[i], ressource);
assert (shared_ressource_end_p(copy[i]));