Skip to content

Commit 4d1fb61

Browse files
committed
py/mpz: Make mpz_is_zero() an inline function.
It's more efficient as an inline function, and saves code size.
1 parent aa7be82 commit 4d1fb61

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

py/mpz.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -939,10 +939,6 @@ void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf)
939939
z->len = mpn_remove_trailing_zeros(z->dig, z->dig + z->len);
940940
}
941941

942-
bool mpz_is_zero(const mpz_t *z) {
943-
return z->len == 0;
944-
}
945-
946942
#if 0
947943
these functions are unused
948944

py/mpz.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void mpz_set_from_float(mpz_t *z, mp_float_t src);
111111
size_t mpz_set_from_str(mpz_t *z, const char *str, size_t len, bool neg, unsigned int base);
112112
void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf);
113113

114-
bool mpz_is_zero(const mpz_t *z);
114+
static inline bool mpz_is_zero(const mpz_t *z) { return z->len == 0; }
115115
int mpz_cmp(const mpz_t *lhs, const mpz_t *rhs);
116116

117117
void mpz_abs_inpl(mpz_t *dest, const mpz_t *z);

0 commit comments

Comments
 (0)