diff --git a/LAB1/Makefile b/LAB1/Makefile index 1ef6fcf..394275a 100644 --- a/LAB1/Makefile +++ b/LAB1/Makefile @@ -23,4 +23,11 @@ btestexplicit: clean: rm -f *.o btest fshow ishow *~ +oneshoot: + make clean; \ + ./dlc bits.c; \ + make btest; \ + ./btest bits.c; \ + make clean \ + diff --git a/LAB1/bits.c b/LAB1/bits.c index 8701616..5aa4981 100644 --- a/LAB1/bits.c +++ b/LAB1/bits.c @@ -281,7 +281,7 @@ int isLessOrEqual(int x, int y) { * Rating: 4 */ int logicalNeg(int x) { - return 2; + return ((x|(~x+1))>>31)+1; } /* howManyBits - return the minimum number of bits required to represent x in * two's complement diff --git a/README.md b/README.md index dfd4736..ee7bc20 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,7 @@ A CSAPP LAB 4. Finish isAsciiDigit 5. Finish isLessOrEqual + +6. Finish logicalNeg + +7. Update Makefile \ No newline at end of file