aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpicoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mpi/mpicoder.c')
-rw-r--r--lib/mpi/mpicoder.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
index 3962b7f7fe3f..5f9c44cdf1f5 100644
--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -52,7 +52,7 @@ MPI mpi_read_raw_data(const void *xbuffer, size_t nbytes)
52 else 52 else
53 nbits = 0; 53 nbits = 0;
54 54
55 nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; 55 nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB);
56 val = mpi_alloc(nlimbs); 56 val = mpi_alloc(nlimbs);
57 if (!val) 57 if (!val)
58 return NULL; 58 return NULL;
@@ -96,8 +96,8 @@ MPI mpi_read_from_buffer(const void *xbuffer, unsigned *ret_nread)
96 buffer += 2; 96 buffer += 2;
97 nread = 2; 97 nread = 2;
98 98
99 nbytes = (nbits + 7) / 8; 99 nbytes = DIV_ROUND_UP(nbits, 8);
100 nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; 100 nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB);
101 val = mpi_alloc(nlimbs); 101 val = mpi_alloc(nlimbs);
102 if (!val) 102 if (!val)
103 return NULL; 103 return NULL;
@@ -193,7 +193,7 @@ int mpi_set_buffer(MPI a, const void *xbuffer, unsigned nbytes, int sign)
193 int nlimbs; 193 int nlimbs;
194 int i; 194 int i;
195 195
196 nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB; 196 nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB);
197 if (RESIZE_IF_NEEDED(a, nlimbs) < 0) 197 if (RESIZE_IF_NEEDED(a, nlimbs) < 0)
198 return -ENOMEM; 198 return -ENOMEM;
199 a->sign = sign; 199 a->sign = sign;