This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog:spring2024:projects:dtr0 [2024/02/14 06:16] – [BITWISE LOGIC: XOR] hcopp1 | notes:cprog:spring2024:projects:dtr0 [2024/02/14 20:39] (current) – [INTEGER VALUES] cgrant9 | ||
---|---|---|---|
Line 14: | Line 14: | ||
In this project we are looking at 10 different types of data values, that are all variations of integers with different byte sizes: | In this project we are looking at 10 different types of data values, that are all variations of integers with different byte sizes: | ||
- | < | + | < |
- | unsigned long long int --- 16 bytes | + | unsigned long long int --- 8 bytes |
signed long int --- 8 bytes | signed long int --- 8 bytes | ||
unsigned long int --- 8 bytes | unsigned long int --- 8 bytes | ||
Line 24: | Line 24: | ||
signed char --- 1 byte | signed char --- 1 byte | ||
unsigned char --- 1 byte</ | unsigned char --- 1 byte</ | ||
- | As you can see they follow the pattern of long doubling, and half, halving, the exception is character, which is essentially a half half integer, in fact it would be abbreviated as either hhd or hhu depending on its signing. | + | |
Line 61: | Line 61: | ||
=210</ | =210</ | ||
====REPRESENTATION: | ====REPRESENTATION: | ||
+ | |||
+ | Hexadecimal Table: | ||
+ | |||
+ | '' | ||
+ | < | ||
+ | Hex | ||
+ | 0 0000 0 | ||
+ | 1 0001 1 | ||
+ | 2 0010 2 | ||
+ | 3 0011 3 | ||
+ | 4 0100 4 | ||
+ | 5 0101 5 | ||
+ | 6 0110 6 | ||
+ | 7 0111 7 | ||
+ | 8 1000 8 | ||
+ | 9 1001 9 | ||
+ | A 1010 10 | ||
+ | B 1011 11 | ||
+ | C 1100 12 | ||
+ | D 1101 13 | ||
+ | E 1110 14 | ||
+ | F 1111 15 | ||
+ | ----------------------- | ||
+ | 10 | ||
+ | 20 | ||
+ | 30 | ||
+ | 40 | ||
+ | 50 | ||
+ | 60 | ||
+ | 70 | ||
+ | 80 | ||
+ | 90 | ||
+ | A0 | ||
+ | B0 | ||
+ | C0 | ||
+ | D0 | ||
+ | E0 | ||
+ | F0 | ||
+ | ------------------------- | ||
+ | 11 | ||
+ | 12 | ||
+ | 13 | ||
+ | 14 | ||
+ | 15 | ||
+ | 16 | ||
+ | 17 | ||
+ | 18 | ||
+ | ------------------------- | ||
+ | FF | ||
+ | 100 | ||
+ | </ | ||
+ | |||
+ | -//Single digit// | ||
+ | < | ||
+ | 5 + A = | ||
+ | (5) + (10) | ||
+ | Decimal = 15 | ||
+ | Hexadecimal = F | ||
+ | | ||
+ | MAX SINGLE = F or 15 or 1111 | ||
+ | </ | ||
+ | |||
+ | -//Double Digit//- | ||
+ | < | ||
+ | 1F + AB | ||
+ | ((16*1)+15) + ((16*10)+11) | ||
+ | Decimal = 31 + 171 = 202 | ||
+ | Hexadecimal = CA | ||
+ | | ||
+ | MAX DOUBLE DIGIT = FF or 255 or 11111111 | ||
+ | </ | ||
====STORAGE: | ====STORAGE: | ||
Line 66: | Line 137: | ||
====BITWISE LOGIC: AND==== | ====BITWISE LOGIC: AND==== | ||
- | __An AND logic gate has 2 inputs/ | + | __An AND logic gate has 2 inputs/ |
**EXAMPLE** - To login you need both a valid email and password; | **EXAMPLE** - To login you need both a valid email and password; | ||
Line 91: | Line 162: | ||
| | ||
| | | | ||
- | ( 1 ) -------------- | + | ( 1 ) -------------- |
- | + | ||
- | ( 0 ) -------------- | + | |
- | | | + | |
- | | + | |
- | | | + | |
- | ( 0 ) -------------- | + | |
</ | </ | ||
//List of all AND gate Interactions// | //List of all AND gate Interactions// | ||
- | - **0 & 0 = 1** | + | - 0 & 0 = 0 |
- 0 & 1 = 0 | - 0 & 1 = 0 | ||
- 1 & 1 = 1 | - 1 & 1 = 1 | ||
Line 109: | Line 174: | ||
====BITWISE LOGIC: OR==== | ====BITWISE LOGIC: OR==== | ||
+ | __An OR logic gate has 2 input/ | ||
+ | EXAMPLE - You can have a free ice cream cone | ||
+ | < | ||
+ | (1scoopOfVanilla)--- | ||
+ | | | ||
+ | | ||
+ | | | ||
+ | (0scoopsOfChocolate) | ||
+ | |||
+ | (1scoopOfVanilla)--- | ||
+ | | | ||
+ | | ||
+ | | | ||
+ | (1scoopsOfChocolate) | ||
+ | |||
+ | (0scoopOfVanilla)--- | ||
+ | | | ||
+ | | ||
+ | | | ||
+ | (0scoopsOfChocolate) | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | //List of all OR gate Interactions// | ||
+ | - 0 & 0 = 0 | ||
+ | - 0 & 1 = 1 | ||
+ | - **1 & 1 = 1** | ||
+ | - 1 & 0 = 1 | ||
====BITWISE LOGIC: XOR==== | ====BITWISE LOGIC: XOR==== | ||
Line 118: | Line 212: | ||
(1scoopOfVanilla)--- | (1scoopOfVanilla)--- | ||
| | | | ||
- | |--[OR]--( free ice cream ) | + | |--[XOR]--( free ice cream ) |
| | | | ||
(0scoopsOfChocolate) | (0scoopsOfChocolate) | ||
Line 124: | Line 218: | ||
(0scoopOfVanilla)--- | (0scoopOfVanilla)--- | ||
| | | | ||
- | |--[OR]--( free ice cream ) | + | |--[XOR]--( free ice cream ) |
| | | | ||
(1scoopsOfChocolate) | (1scoopsOfChocolate) | ||
Line 130: | Line 224: | ||
(0scoopOfVanilla)--- | (0scoopOfVanilla)--- | ||
| | | | ||
- | |--[OR]--(No free ice cream ) | + | |--[XOR]--(No free ice cream ) |
| | | | ||
(0scoopsOfChocolate) | (0scoopsOfChocolate) | ||
Line 136: | Line 230: | ||
(1scoopOfVanilla)--- | (1scoopOfVanilla)--- | ||
| | | | ||
- | |--[OR]--(no free ice cream ) | + | |--[XOR]--(no free ice cream ) |
| | | | ||
(1scoopsOfChocolate) | (1scoopsOfChocolate) | ||
Line 145: | Line 239: | ||
- 0 & 0 = 0 | - 0 & 0 = 0 | ||
- 0 & 1 = 1 | - 0 & 1 = 1 | ||
- | - 1 & 1 = 0 | + | - **1 & 1 = 0** |
- 1 & 0 = 1 | - 1 & 0 = 1 | ||
====BITWISE LOGIC: NOT==== | ====BITWISE LOGIC: NOT==== | ||
+ | A NOT gate inverts the input. It only has a single input. | ||
+ | |||
+ | EXAMPLE - Its opposite day | ||
+ | < | ||
+ | |||
+ | ( YES )------|[NOT]> | ||
+ | |||
+ | ( 1 )--------|[NOT]> | ||
+ | |||
+ | </ | ||
+ | |||
+ | //List of possible NOT gate interactions// | ||
+ | - 1 = 0 | ||
+ | - 0 = 1 |