Compare commits
2 Commits
901757b211
...
57a619ac7b
| Author | SHA1 | Date | |
|---|---|---|---|
| 57a619ac7b | |||
| 791672d18d |
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* CSE4009 Assignment 1 - Data Lab
|
* CSE4009 Assignment 1 - Data Lab
|
||||||
*
|
*
|
||||||
* <Please put your name and userid here>
|
* name: Hajin Ju, id: 2024062806
|
||||||
*
|
*
|
||||||
* bits.c - Source file with your solutions to the Lab.
|
* bits.c - Source file with your solutions to the Lab.
|
||||||
* This is the file you will hand in to your instructor.
|
* This is the file you will hand in to your instructor.
|
||||||
@@ -132,7 +132,6 @@ NOTES:
|
|||||||
* the correct answers.
|
* the correct answers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
|
/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
@@ -178,7 +177,7 @@ NOTES:
|
|||||||
* Rating: 1
|
* Rating: 1
|
||||||
*/
|
*/
|
||||||
int bitAnd(int x, int y) {
|
int bitAnd(int x, int y) {
|
||||||
return 2;
|
return ~(~x | ~y);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* bitXor - x^y using only ~ and &
|
* bitXor - x^y using only ~ and &
|
||||||
@@ -188,7 +187,7 @@ int bitAnd(int x, int y) {
|
|||||||
* Rating: 1
|
* Rating: 1
|
||||||
*/
|
*/
|
||||||
int bitXor(int x, int y) {
|
int bitXor(int x, int y) {
|
||||||
return 2;
|
return x & ~y | ~x & y;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* isTmin - returns 1 if x is the minimum, two's complement number,
|
* isTmin - returns 1 if x is the minimum, two's complement number,
|
||||||
@@ -198,7 +197,7 @@ int bitXor(int x, int y) {
|
|||||||
* Rating: 1
|
* Rating: 1
|
||||||
*/
|
*/
|
||||||
int isTmin(int x) {
|
int isTmin(int x) {
|
||||||
return 2;
|
return !!x & !(x ^ (~x + 1));
|
||||||
}
|
}
|
||||||
//2
|
//2
|
||||||
/*
|
/*
|
||||||
@@ -209,7 +208,7 @@ int isTmin(int x) {
|
|||||||
* Rating: 2
|
* Rating: 2
|
||||||
*/
|
*/
|
||||||
int isEqual(int x, int y) {
|
int isEqual(int x, int y) {
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* negate - return -x
|
* negate - return -x
|
||||||
@@ -219,7 +218,7 @@ int isEqual(int x, int y) {
|
|||||||
* Rating: 2
|
* Rating: 2
|
||||||
*/
|
*/
|
||||||
int negate(int x) {
|
int negate(int x) {
|
||||||
return 2;
|
return ~x + 1;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* getByte - Extract byte n from word x
|
* getByte - Extract byte n from word x
|
||||||
|
|||||||
6
notes/2.md
Normal file
6
notes/2.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Machine Level Programming
|
||||||
|
|
||||||
|
아키텍쳐(ISA)
|
||||||
|
* intel(x86): CISC
|
||||||
|
* ARM(aarch64, aarch32): RISC
|
||||||
|
|
||||||
BIN
pdf/L3.pdf
(Stored with Git LFS)
Normal file
BIN
pdf/L3.pdf
(Stored with Git LFS)
Normal file
Binary file not shown.
Reference in New Issue
Block a user