diff --git a/gmp-glue.h b/gmp-glue.h
index 648724bc756f6c57c8942bf996d2392f353097ff..38cdd197ee0d82ddaaef286ef97d841b41acd33f 100644
--- a/gmp-glue.h
+++ b/gmp-glue.h
@@ -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. */