summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2021-09-08 07:25:05 +0200
committerjonsykkel <jonrevold@gmail.com>2021-09-08 07:25:05 +0200
commit77bb81e4f5d101a8858c667537df18a56a5681ef (patch)
tree3ba67e43f0732d7274f71a66b8cf090cdb6ff0f7
parente32c23f253c980150265046c1337c42fce063601 (diff)
downloadokeffa-77bb81e4f5d101a8858c667537df18a56a5681ef.tar.gz
not
-rw-r--r--inc/okeffa/w_op.h8
-rw-r--r--src/w_op.c2
2 files changed, 10 insertions, 0 deletions
diff --git a/inc/okeffa/w_op.h b/inc/okeffa/w_op.h
index fca739f..3f615b5 100644
--- a/inc/okeffa/w_op.h
+++ b/inc/okeffa/w_op.h
@@ -2,11 +2,14 @@
#define OKEFFA_W_OP_H
#include <okeffa/word.h>
+#include <assert.h>
inline wbool_t w_carry (word_t a,word_t b,word_t s);
inline wbool_t w_borrow (word_t a,word_t b,word_t d);
inline word_t w_mux (word_t a,word_t b,wbool_t sel);
+inline wbool_t wb_not (wbool_t a);
+
////////////////////////////////////////////////////////////////
inline wbool_t w_carry(word_t a,word_t b,word_t s){
@@ -21,4 +24,9 @@ inline word_t w_mux(word_t a,word_t b,wbool_t sel){
return b ^ (sel-1 & (a ^ b));
}
+inline wbool_t wb_not(wbool_t a){
+ assert(((word_t)a & 1) == a);
+ return a ^ 1;
+}
+
#endif
diff --git a/src/w_op.c b/src/w_op.c
index 0b62b06..5e32354 100644
--- a/src/w_op.c
+++ b/src/w_op.c
@@ -3,3 +3,5 @@
extern wbool_t w_carry (word_t a,word_t b,word_t s);
extern wbool_t w_borrow (word_t a,word_t b,word_t d);
extern word_t w_mux (word_t a,word_t b,wbool_t sel);
+
+extern wbool_t wb_not (wbool_t a);