From f49d972540161f5a3d5a0d05efd962cffc122e0c Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Wed, 30 Jan 2013 11:30:06 +0200 Subject: [PATCH] --- yaml --- r: 352849 b: refs/heads/master c: 0d2a1b2d03dfd5ee79e7ebc59635690c8f08810f h: refs/heads/master i: 352847: e9ffb297520ebd70fc60656959d98a8a6fec0547 v: v3 --- [refs] | 2 +- trunk/lib/mpi/mpi-internal.h | 4 ---- trunk/lib/mpi/mpicoder.c | 8 ++++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 98250eeedb0d..9a7ebef81da4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 26d438457ed1b99b6cb26d8f694e8d3de336f9d8 +refs/heads/master: 0d2a1b2d03dfd5ee79e7ebc59635690c8f08810f diff --git a/trunk/lib/mpi/mpi-internal.h b/trunk/lib/mpi/mpi-internal.h index 77adcf6bc257..60cf765628e9 100644 --- a/trunk/lib/mpi/mpi-internal.h +++ b/trunk/lib/mpi/mpi-internal.h @@ -65,10 +65,6 @@ typedef mpi_limb_t *mpi_ptr_t; /* pointer to a limb */ typedef int mpi_size_t; /* (must be a signed type) */ -#define ABS(x) (x >= 0 ? x : -x) -#define MIN(l, o) ((l) < (o) ? (l) : (o)) -#define MAX(h, i) ((h) > (i) ? (h) : (i)) - static inline int RESIZE_IF_NEEDED(MPI a, unsigned b) { if (a->alloced < b) diff --git a/trunk/lib/mpi/mpicoder.c b/trunk/lib/mpi/mpicoder.c index 3962b7f7fe3f..5f9c44cdf1f5 100644 --- a/trunk/lib/mpi/mpicoder.c +++ b/trunk/lib/mpi/mpicoder.c @@ -52,7 +52,7 @@ MPI mpi_read_raw_data(const void *xbuffer, size_t nbytes) else nbits = 0; - nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; + nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB); val = mpi_alloc(nlimbs); if (!val) return NULL; @@ -96,8 +96,8 @@ MPI mpi_read_from_buffer(const void *xbuffer, unsigned *ret_nread) buffer += 2; nread = 2; - nbytes = (nbits + 7) / 8; - nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; + nbytes = DIV_ROUND_UP(nbits, 8); + nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB); val = mpi_alloc(nlimbs); if (!val) return NULL; @@ -193,7 +193,7 @@ int mpi_set_buffer(MPI a, const void *xbuffer, unsigned nbytes, int sign) int nlimbs; int i; - nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; + nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB); if (RESIZE_IF_NEEDED(a, nlimbs) < 0) return -ENOMEM; a->sign = sign;