aboutsummaryrefslogtreecommitdiffstats
path: root/zahl.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-05 20:59:03 +0100
committerMattias Andrée <maandree@kth.se>2016-03-05 20:59:03 +0100
commit48a89e0e110907a7a60ed8f5a0977e3b34661259 (patch)
tree26b328e070d60f3e3f484d5b92fd01e8239e33d9 /zahl.h
parentImprove zsub, only copy to temp when necessary (diff)
downloadlibzahl-48a89e0e110907a7a60ed8f5a0977e3b34661259.tar.gz
libzahl-48a89e0e110907a7a60ed8f5a0977e3b34661259.tar.bz2
libzahl-48a89e0e110907a7a60ed8f5a0977e3b34661259.tar.xz
zinit is now an inline function
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--zahl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/zahl.h b/zahl.h
index a5946fc..39d08a2 100644
--- a/zahl.h
+++ b/zahl.h
@@ -42,7 +42,6 @@ void zunsetup(void); /* Free resources used by libzahl */
/* Memory functions. */
-void zinit(z_t); /* Prepare a for use. */
void zfree(z_t); /* Free resources in a. */
void zswap(z_t, z_t); /* (a, b) := (b, a) */
size_t zsave(z_t, void *); /* Store a into b (if !!b), and return number of written bytes. */
@@ -140,9 +139,10 @@ void zperror(const char *); /* Identical to perror(3p) except it supp
/* Inline functions. */
+static inline void zinit(z_t a) { a->alloced = 0; a->chars = 0; } /* Prepare a for use. */
static inline int zeven(z_t a) { return !a->sign || !(a->chars[0] & 1); } /* Is a even? */
static inline int zodd(z_t a) { return a->sign && (a->chars[0] & 1); } /* Is a odd? */
static inline int zeven_nonzero(z_t a) { return !(a->chars[0] & 1); } /* Is a even? Assumes a ≠ 0. */
static inline int zodd_nonzero(z_t a) { return (a->chars[0] & 1); } /* Is a odd? Assumes a ≠ 0. */
static inline int zzero(z_t a) { return !a->sign; } /* Is a zero? */
-static inline int zsignum(z_t a) { return a->sign; } /* a/|a|, 0 if a is zero */
+static inline int zsignum(z_t a) { return a->sign; } /* a/|a|, 0 if a is zero. */