From 7ab24b18b1c9a08b0d092c2c8144ee7b3a029c1d Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Sat, 16 Mar 2019 19:47:03 +0100 Subject: long nand, nor, nxor --- test/monniaux/nand/nand.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'test/monniaux/nand/nand.c') diff --git a/test/monniaux/nand/nand.c b/test/monniaux/nand/nand.c index f808f311..9c2d2298 100644 --- a/test/monniaux/nand/nand.c +++ b/test/monniaux/nand/nand.c @@ -1,22 +1,24 @@ #include -unsigned not(unsigned x) { +typedef unsigned long scalar; + +scalar not(scalar x) { return ~x; } -unsigned nand(unsigned x, unsigned y) { +scalar nand(scalar x, scalar y) { return ~(x & y); } -unsigned nor(unsigned x, unsigned y) { +scalar nor(scalar x, scalar y) { return ~(x | y); } -unsigned nxor(unsigned x, unsigned y) { +scalar nxor(scalar x, scalar y) { return ~(x ^ y); } int main() { - unsigned x = 0xF4, y = 0x33; + scalar x = 0xF4, y = 0x33; printf("%X\n", nxor(x, y)); } -- cgit