commit 4e659044778dfd05a5f5d2b41611e7737a0eb825
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Fri May 6 19:00:44 2016 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Fri May 6 19:00:44 2016 +0200
Make zdiv and zmod (calls zdivmod) inline
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/Makefile b/Makefile
index 7233b87..cb3cbdf 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -11,14 +11,12 @@ FUN =\
zadd\
zand\
zbset\
- zdiv\
zdivmod\
zerror\
zfree\
zgcd\
zload\
zlsh\
- zmod\
zmodmul\
zmodpow\
zmodpowu\
_AT_@ -50,10 +48,12 @@ INLINE_FUN =\
zcmpi\
zcmpmag\
zcmpu\
+ zdiv\
zeven\
zeven_nonzero\
zinit\
zlsb\
+ zmod\
zneg\
zodd\
zodd_nonzero\
diff --git a/src/zdiv.c b/src/zdiv.c
deleted file mode 100644
index 5566bb1..0000000
--- a/src/zdiv.c
+++ /dev/null
_AT_@ -1,9 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include "internals.h"
-
-
-void
-zdiv(z_t a, z_t b, z_t c)
-{
- zdivmod(a, libzahl_tmp_div, b, c);
-}
diff --git a/src/zmod.c b/src/zmod.c
deleted file mode 100644
index 5807e00..0000000
--- a/src/zmod.c
+++ /dev/null
_AT_@ -1,9 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include "internals.h"
-
-
-void
-zmod(z_t a, z_t b, z_t c)
-{
- zdivmod(libzahl_tmp_mod, a, b, c);
-}
diff --git a/zahl.h b/zahl.h
index 5cb9b1a..e2a77c7 100644
--- a/zahl.h
+++ b/zahl.h
_AT_@ -93,9 +93,9 @@ void zadd(z_t, z_t, z_t); /* a := b + c */
void zsub(z_t, z_t, z_t); /* a := b - c */
ZAHL_INLINE void zmul(z_t, z_t, z_t); /* a := b * c */
void zmodmul(z_t, z_t, z_t, z_t); /* a := (b * c) % d */
-void zdiv(z_t, z_t, z_t); /* a := b / c */
+ZAHL_INLINE void zdiv(z_t, z_t, z_t); /* a := b / c */
void zdivmod(z_t, z_t, z_t, z_t); /* a := c / d, b = c % d */
-void zmod(z_t, z_t, z_t); /* a := b % c */
+ZAHL_INLINE void zmod(z_t, z_t, z_t); /* a := b % c */
ZAHL_INLINE void zsqr(z_t, z_t); /* a := b² */
void zmodsqr(z_t, z_t, z_t); /* a := b² % c */
void zpow(z_t, z_t, z_t); /* a := b ↑ c */
diff --git a/zahl/inlines.h b/zahl/inlines.h
index 8f6b490..9884812 100644
--- a/zahl/inlines.h
+++ b/zahl/inlines.h
_AT_@ -291,3 +291,17 @@ zsqr(z_t a, z_t b)
ZAHL_SET_SIGNUM(a, 1);
}
}
+
+
+ZAHL_INLINE void
+zdiv(z_t a, z_t b, z_t c)
+{
+ zdivmod(a, libzahl_tmp_div, b, c);
+}
+
+
+ZAHL_INLINE void
+zmod(z_t a, z_t b, z_t c)
+{
+ zdivmod(libzahl_tmp_mod, a, b, c);
+}
diff --git a/zahl/internals.h b/zahl/internals.h
index e0aa248..672dfcd 100644
--- a/zahl/internals.h
+++ b/zahl/internals.h
_AT_@ -107,6 +107,10 @@ struct zahl {
};
+extern struct zahl libzahl_tmp_div[1];
+extern struct zahl libzahl_tmp_mod[1];
+
+
void libzahl_realloc(struct zahl *, size_t);
ZAHL_INLINE void
Received on Fri May 06 2016 - 19:01:03 CEST
This archive was generated by hypermail 2.3.0
: Fri May 06 2016 - 19:12:14 CEST