diff options
author | Simo Sorce <simo@redhat.com> | 2018-11-08 14:47:13 -0500 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2018-11-24 10:18:09 +0100 |
commit | 98e309bef52ff325b67d5aa083dd384eace426fa (patch) | |
tree | 17de7654e8ef686ccdd49bf2710f2f6340a4fafc /gmp-glue.h | |
parent | 51b64bb84ca860a7b39d1cd121b03e2db3b67743 (diff) | |
download | nettle-98e309bef52ff325b67d5aa083dd384eace426fa.tar.gz |
Add convenience macro for size calculation
Returns number of limbs needed to contain N bytes long number.
Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'gmp-glue.h')
-rw-r--r-- | gmp-glue.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -81,6 +81,9 @@ # define cnd_sub_n(cnd, rp, ap, n) mpn_submul_1 ((rp), (ap), (n), (cnd) != 0) #endif +#define NETTLE_OCTET_SIZE_TO_LIMB_SIZE(n) \ + (((n) * 8 + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS) + /* Some functions for interfacing between mpz and mpn code. Signs of the mpz numbers are generally ignored. */ |