Start adding x86-64 notes.

c-declarations
Joshua Potter 2024-03-22 08:10:08 -06:00
parent 3b6d9d89c5
commit 091521c382
15 changed files with 452 additions and 64 deletions

View File

@ -146,7 +146,7 @@
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
"algorithms/loop-invariant.md": "e39f4aa253f0baf908067bea81f6bced", "algorithms/loop-invariant.md": "e39f4aa253f0baf908067bea81f6bced",
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65", "algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
"algorithms/order-growth.md": "53d41d9abbd1d8118793bad3996d249a", "algorithms/order-growth.md": "513ea484fcdc184170205a425be77742",
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac", "_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
"algorithms/sorting/selection-sort.md": "5ba56adddaf07653290af88f998f6c4a", "algorithms/sorting/selection-sort.md": "5ba56adddaf07653290af88f998f6c4a",
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97", "algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
@ -209,16 +209,16 @@
"combinatorics/inclusion-exclusion.md": "202a60120d451676d44df4d0be30a45a", "combinatorics/inclusion-exclusion.md": "202a60120d451676d44df4d0be30a45a",
"_journal/2024-02-21.md": "b9d944ecebe625da5dd72aeea6a916a2", "_journal/2024-02-21.md": "b9d944ecebe625da5dd72aeea6a916a2",
"_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841", "_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841",
"algebra/radices.md": "03b8452798a6fd4ec5af526371309c4f", "algebra/radices.md": "0a7c37531c6ae4406e1c9e894166ffbe",
"_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a", "_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a",
"_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7", "_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7",
"_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd", "_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd",
"_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b", "_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b",
"c17/strings.md": "b9d2efd54b9a06f50042fb2714dedbf4", "c17/strings.md": "3cedaa7a28f779e24c2665c7afdcf19a",
"c17/index.md": "78576ee41d0185df82c59999142f4edb", "c17/index.md": "78576ee41d0185df82c59999142f4edb",
"c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500", "c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500",
"c17/declarations.md": "cec6866dff8ad160467df62cfceb6872", "c17/declarations.md": "cec6866dff8ad160467df62cfceb6872",
"algorithms/sorting/merge-sort.md": "e0e9108566d2de0ff9fd211a573fca8d", "algorithms/sorting/merge-sort.md": "a04394c72bd35bd84fe796bbc8ed1a0a",
"_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4", "_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4",
"_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7", "_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7",
"_journal/2024-02-25.md": "fb1a48208c11d12262facc647749ca6f", "_journal/2024-02-25.md": "fb1a48208c11d12262facc647749ca6f",
@ -233,7 +233,7 @@
"filesystems/cas.md": "34906013a2a60fe5ee0e31809b4838aa", "filesystems/cas.md": "34906013a2a60fe5ee0e31809b4838aa",
"git/objects.md": "e9b98576291ca04496c2f0863f526cfa", "git/objects.md": "e9b98576291ca04496c2f0863f526cfa",
"git/index.md": "83d2d95fc549d9e8436946c7bd058d15", "git/index.md": "83d2d95fc549d9e8436946c7bd058d15",
"encoding/integer.md": "6b9e0589706f57089a1c2ede93dc43b8", "encoding/integer.md": "d4866b6e236c3a67631d03582996eca2",
"_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508", "_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508",
"_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82", "_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82",
"_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe", "_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe",
@ -278,24 +278,30 @@
"_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39", "_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39",
"_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7", "_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7",
"_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0", "_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0",
"encoding/floating-point.md": "376c963b043e4f4f603b2eaa3cfdb8ae", "encoding/floating-point.md": "83c663e3ecc51498968010d1931bd794",
"_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f", "_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f",
"_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b", "_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b",
"set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53", "set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53",
"set/index.md": "b82a215fbee3c576186fc1af93c82fcb", "set/index.md": "b82a215fbee3c576186fc1af93c82fcb",
"set/graphs.md": "dda79b615896d19a3041fbc0ee16b1da", "set/graphs.md": "82c4938f9f6479c75d946c8e1263a5a1",
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb", "_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
"_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391", "_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391",
"awk/variables.md": "e40a20545358228319f789243d8b9f77", "awk/variables.md": "e40a20545358228319f789243d8b9f77",
"awk/regexp.md": "4ce38103575a5321a1503b28e1d714dd", "awk/regexp.md": "4ce38103575a5321a1503b28e1d714dd",
"awk/index.md": "257738d2d864933fb4bd21e8609c525d", "awk/index.md": "257738d2d864933fb4bd21e8609c525d",
"_journal/2024-03-20.md": "9f6ff3e38774f6a90e0dc606b201303d", "_journal/2024-03-20.md": "2403b0aebe301123192cfa1085f0d874",
"_journal/2024-03/2024-03-19.md": "a24995a82bcebcc2b2aa5815a19a8af7", "_journal/2024-03/2024-03-19.md": "a24995a82bcebcc2b2aa5815a19a8af7",
"posix/awk/variables.md": "cc7e912c7fbda552d27e2064d84d15a5", "posix/awk/variables.md": "cc7e912c7fbda552d27e2064d84d15a5",
"posix/awk/regexp.md": "46ceac3d5225ea3f3a375d74c2e2e0e9", "posix/awk/regexp.md": "46ceac3d5225ea3f3a375d74c2e2e0e9",
"posix/awk/index.md": "cac4a1db94f9fc39c5e63ff6994b76aa", "posix/awk/index.md": "cac4a1db94f9fc39c5e63ff6994b76aa",
"assembly/x86.md": "ff0f19c990e16008caa34dd51b2693b7", "x86-64/assembly.md": "6c4905468f3936ae260b281e2acd7ffc",
"assembly/index.md": "0cd9daf2c60c7181b6aec9aaf62a13ba" "x86-64/index.md": "4769ab45ca374c4225c9c4099220be82",
"_journal/2024-03-21.md": "a2572d2d5be0ee7c7f066d846e2f3e77",
"_journal/2024-03/2024-03-20.md": "0a73ce399d275fe6ee3134a812f3f4f9",
"_journal/2024-03-22.md": "6c14bacf3e8834359f8512b7d7055acc",
"_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3",
"x86-64/declarations.md": "60f5b240ea5565b33dc3585169fc41b1",
"x86-64/instructions.md": "c4b116179d2bd1f9510437e000f9c63d"
}, },
"fields_dict": { "fields_dict": {
"Basic": [ "Basic": [

View File

@ -0,0 +1,14 @@
---
title: "2024-03-22"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
* Reach section 3.3 of "Computer Systems: A Programmer's Perspective".
* Basic [[x86-64/declarations|Intel data types]] and historical context around their naming.

View File

@ -7,14 +7,21 @@ title: "2024-03-20"
- [ ] Sheet Music (10 min.) - [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem) - [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story) - [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem) - [x] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours) - [x] Log Work Hours (Max 3 hours)
* Purged some Anki flashcards with tags: `lua`, `cncf`. In general, want to avoid on this next pass including any sort of flashcards around languages outside of C and: * Purged some Anki flashcards with tags: `lua`, `cncf`. In general, want to avoid on this next pass including any sort of flashcards around languages outside of C and:
* Bash
* Lean * Lean
* Nix * Nix
* Assembly * SQL
* x86-64 Assembly
* I also want to avoid learning general syntax (specific gotchas are reasonable) over general concepts where it makes sense.
* Made distinctions in flashcards between POSIX `awk` features and GNU `awk` features. Only a few exceptions that may have been misleading so far (GNU's implementation allowing `FS` to be null and `RS` to be a regexp). * Made distinctions in flashcards between POSIX `awk` features and GNU `awk` features. Only a few exceptions that may have been misleading so far (GNU's implementation allowing `FS` to be null and `RS` to be a regexp).
* Actually, going further, just removing this altogether. I'll continue reading about `awk` but I'm not interested in translating into flashcards unless it turns out I really start using it heavily. * Actually, going further, just removing this altogether. I'll continue reading about `awk` but I'm not interested in translating into flashcards unless it turns out I really start using it heavily.
* Read Chapter 5 "Printing" in "GAWK: Effective AWK Programming". * Read Chapter 5 "Printing" in "GAWK: Effective AWK Programming".
* Notes on [[x86]] history. * Notes on [[instructions]] history.
* Leetcode Problems
* [Pow(x, n)](https://leetcode.com/problems/powx-n/)
* [Group Anagrams](https://leetcode.com/problems/group-anagrams/)
* Basic pass for a type-safe spreadsheet program.

View File

@ -0,0 +1,15 @@
---
title: "2024-03-21"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Talked with Mike about chapter 3 and 4 of "Designing Data-Intensive Applications"
* Finished Level 4 Update for D&D campaign.
* Created the "Hierarchy of Goals" worksheet for the soft-skills course.

View File

@ -13,7 +13,7 @@ The **radix** is the number of unique digits used to represent numbers in a posi
%%ANKI %%ANKI
Basic Basic
What is the process of subtracting a larger digit from a smaller one in radix $r$? What is the process of subtracting a larger digit from a smaller one in radix $r$?
Back: Decrement the next non-zero and add $r$ to the smaller digit in question. Back: Decrement the next nonzero and add $r$ to the smaller digit in question.
Reference: “Radix,” in *Wikipedia*, August 6, 2023, [https://en.wikipedia.org/w/index.php?title=Radix&oldid=1169046173](https://en.wikipedia.org/w/index.php?title=Radix&oldid=1169046173). Reference: “Radix,” in *Wikipedia*, August 6, 2023, [https://en.wikipedia.org/w/index.php?title=Radix&oldid=1169046173](https://en.wikipedia.org/w/index.php?title=Radix&oldid=1169046173).
<!--ID: 1708534662981--> <!--ID: 1708534662981-->
END%% END%%

View File

@ -995,7 +995,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What theorem relates $\Theta(g(n))$, $O(g(n))$, and $\Omega(g(n))$? What theorem relates $\Theta(g(n))$, $O(g(n))$, and $\Omega(g(n))$?
Back: $f(n) = \Theta(g(n))$ if and only if $f(n) \in O(g(n))$ and $f(n) \in \Omega(g(n))$. Back: $f(n) = \Theta(g(n))$ if and only if $f(n) = O(g(n))$ and $f(n) = \Omega(g(n))$.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1709055157406--> <!--ID: 1709055157406-->
END%% END%%

View File

@ -9,14 +9,14 @@ tags:
## Overview ## Overview
Property | Value | Property | Value |
----------- | -------- | ----------- | ----------------- |
Best Case | $\Omega(n\lg{n})$ | Best Case | $\Omega(n\lg{n})$ |
Worst Case | $O(n\lg{n})$ | Worst Case | $O(n\lg{n})$ |
Avg. Case | $O(n\lg{n})$ | Avg. Case | $O(n\lg{n})$ |
Aux. Memory | - | Aux. Memory | $O(n)$ |
Stable | - | Stable | - |
Adaptive | - | Adaptive | - |
![[merge-sort.gif]] ![[merge-sort.gif]]
@ -52,6 +52,14 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (
<!--ID: 1708742467115--> <!--ID: 1708742467115-->
END%% END%%
%%ANKI
Basic
How much auxiliary space does `MERGE_SORT` use?
Back: $O(n)$
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1711024614320-->
END%%
%%ANKI %%ANKI
Basic Basic
What is the "divide" step of `MERGE_SORT`? What is the "divide" step of `MERGE_SORT`?

View File

@ -1,7 +0,0 @@
---
title: Assembly
TARGET DECK: Obsidian::STEM
FILE TAGS: asm
tags:
- asm
---

View File

@ -80,13 +80,13 @@ Tags: printf
<!--ID: 1708425941269--> <!--ID: 1708425941269-->
END%% END%%
Flag | Description | Flag | Description |
---- | ----------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
`-` | Left-aligns the output | `-` | Left-aligns the output |
`+` | Prepends a plus for positive signed-numeric types | `+` | Prepends a plus for positive signed-numeric types |
`␣` | Prepends a space for positive signed-numeric types | `␣` | Prepends a space for positive signed-numeric types |
`0` | Prepends zeros for numeric types | `0` | Prepends zeros for numeric types |
`#` | For `g` and `G`, trailing zeros are not removed. For `f`, `F`, `e`, `E`, `g`, and `G`, output always has a decimal point. For `o`, `x`, and `X`, the text `0`, `0x`, and `0X` is prepended to non-zero numbers respectively. | `#` | For `g` and `G`, trailing zeros are not removed. For `f`, `F`, `e`, `E`, `g`, and `G`, output always has a decimal point. For `o`, `x`, and `X`, the text `0`, `0x`, and `0X` is prepended to nonzero numbers respectively. |
%%ANKI %%ANKI
Cloze Cloze

View File

@ -34,7 +34,7 @@ Declaration | Sign Bit | Exponent Field | Fractional Field
%%ANKI %%ANKI
Basic Basic
In base-10 scientific notation, what form do non-zero numbers take on? In base-10 scientific notation, what form do nonzero numbers take on?
Back: $m \times 10^n$ Back: $m \times 10^n$
Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750).
<!--ID: 1710556914921--> <!--ID: 1710556914921-->
@ -51,7 +51,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
In base-10 scientific notation, what numbers does $m$ take on in form $m \times 10^n$? In base-10 scientific notation, what numbers does $m$ take on in form $m \times 10^n$?
Back: A non-zero real number. Back: A nonzero real number.
Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750).
<!--ID: 1710556914926--> <!--ID: 1710556914926-->
END%% END%%
@ -90,7 +90,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
In base-2 scientific notation, what form do non-zero numbers take on? In base-2 scientific notation, what form do nonzero numbers take on?
Back: $m \times 2^n$ Back: $m \times 2^n$
Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750).
<!--ID: 1710556914939--> <!--ID: 1710556914939-->
@ -107,7 +107,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
In base-2 scientific notation, what numbers does $m$ take on in form $m \times 2^n$? In base-2 scientific notation, what numbers does $m$ take on in form $m \times 2^n$?
Back: A non-zero real number. Back: A nonzero real number.
Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750).
<!--ID: 1710556914943--> <!--ID: 1710556914943-->
END%% END%%
@ -697,7 +697,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What is the actual bit encoding of floating-point number $NaN$? What is the actual bit encoding of floating-point number $NaN$?
Back: An exponent field of all `1`s and a non-zero fractional field. Back: An exponent field of all `1`s and a nonzero fractional field.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710556915092--> <!--ID: 1710556915092-->
END%% END%%
@ -1062,7 +1062,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.40` rounded in round-to-even mode? How is floating-point `1.40` rounded to an integer in round-to-even mode?
Back: `1` Back: `1`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824759--> <!--ID: 1710680824759-->
@ -1070,7 +1070,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.50` rounded in round-to-even mode? How is floating-point `1.50` rounded to an integer in round-to-even mode?
Back: `2` Back: `2`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824761--> <!--ID: 1710680824761-->
@ -1078,7 +1078,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.60` rounded in round-to-even mode? How is floating-point `1.60` rounded to an integer in round-to-even mode?
Back: `2` Back: `2`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824763--> <!--ID: 1710680824763-->
@ -1086,7 +1086,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `-1.50` rounded in round-to-even mode? How is floating-point `-1.50` rounded to an integer in round-to-even mode?
Back: `-2` Back: `-2`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824765--> <!--ID: 1710680824765-->
@ -1094,7 +1094,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.40` rounded in round-to-zero mode? How is floating-point `1.40` rounded to an integer in round-to-zero mode?
Back: `1` Back: `1`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824767--> <!--ID: 1710680824767-->
@ -1102,7 +1102,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.50` rounded in round-to-zero mode? How is floating-point `1.50` rounded to an integer in round-to-zero mode?
Back: `1` Back: `1`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824769--> <!--ID: 1710680824769-->
@ -1110,7 +1110,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `-1.50` rounded in round-to-zero mode? How is floating-point `-1.50` rounded to an integer in round-to-zero mode?
Back: `-1` Back: `-1`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824771--> <!--ID: 1710680824771-->
@ -1118,7 +1118,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.40` rounded in round-down mode? How is floating-point `1.40` rounded to an integer in round-down mode?
Back: `1` Back: `1`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824774--> <!--ID: 1710680824774-->
@ -1126,7 +1126,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.50` rounded in round-down mode? How is floating-point `1.50` rounded to an integer in round-down mode?
Back: `1` Back: `1`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824776--> <!--ID: 1710680824776-->
@ -1134,7 +1134,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `-1.50` rounded in round-down mode? How is floating-point `-1.50` rounded to an integer in round-down mode?
Back: `-2` Back: `-2`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824778--> <!--ID: 1710680824778-->
@ -1142,7 +1142,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.40` rounded in round-up mode? How is floating-point `1.40` rounded to an integer in round-up mode?
Back: `2` Back: `2`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824780--> <!--ID: 1710680824780-->
@ -1150,7 +1150,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `1.50` rounded in round-up mode? How is floating-point `1.50` rounded to an integer in round-up mode?
Back: `2` Back: `2`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824782--> <!--ID: 1710680824782-->
@ -1158,7 +1158,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How is floating-point `-1.50` rounded in round-up mode? How is floating-point `-1.50` rounded to an integer in round-up mode?
Back: `-1` Back: `-1`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824785--> <!--ID: 1710680824785-->
@ -1207,7 +1207,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
How does the IEEE floating-point standard define $1/+0$? How does the IEEE floating-point standard define $1/+0$?
Back: $\infty$ Back: $+\infty$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824798--> <!--ID: 1710680824798-->
END%% END%%
@ -1312,7 +1312,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
What is the result of $x *^f* y$? What is the result of $x *^f y$?
Back: $Round(x * y)$ where $Round$ refers to the current rounding-mode. Back: $Round(x * y)$ where $Round$ refers to the current rounding-mode.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710680824827--> <!--ID: 1710680824827-->

View File

@ -533,7 +533,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Why is two's-complement named the way it is? Why is it "two's-complement" instead of "twos'-complement"?
Back: Because there is only one $2$ in $2^w - x$. Back: Because there is only one $2$ in $2^w - x$.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1709060837130--> <!--ID: 1709060837130-->

View File

@ -107,7 +107,7 @@ END%%
%%ANKI %%ANKI
Basic Basic
Let $G = \langle V, E \rangle$ be a undirected graph. What conditions must $E$ satisfy? Let $G = \langle V, E \rangle$ be an undirected graph. What conditions must $E$ satisfy?
Back: It is a set of unordered pairs of vertices. Back: It is a set of unordered pairs of vertices.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1710793937813--> <!--ID: 1710793937813-->

View File

@ -0,0 +1,242 @@
---
title: Declarations
TARGET DECK: Obsidian::STEM
FILE TAGS: x86-64
tags:
- x86-64
---
## Overview
| C Declaration | Intel Data Type | Suffix | Size (bytes) |
| ------------- | ---------------- | ------ | ------------ |
| `char` | Byte | `b` | 1 |
| `short` | Word | `w` | 2 |
| `int` | Double word | `l` | 4 |
| `long` | Quad word | `q` | 8 |
| `char *` | Quad word | `q` | 8 |
| `float` | Single-precision | `s` | 4 |
| `double` | Double-precision | `l` | 8 |
%%ANKI
Basic
What is the width of a word?
Back: 16 bits.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523806-->
END%%
%%ANKI
Basic
What historical reason explains why a word is 16 bits?
Back: Because the 8086 that introduced x86 was 16 bits.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523813-->
END%%
%%ANKI
Basic
What is the width of an Intel "byte"?
Back: $8$ bits
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523816-->
END%%
%%ANKI
Basic
Which Intel data types are 1 bytes wide?
Back: Just the "byte".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523818-->
END%%
%%ANKI
Cloze
The "{byte}" Intel data type has assembly-code suffix {`b`}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523821-->
END%%
%%ANKI
Basic
What is the width of an Intel "word"?
Back: $16$ bits
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523824-->
END%%
%%ANKI
Basic
Which Intel data types are 2 bytes wide?
Back: Just the "word".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523827-->
END%%
%%ANKI
Cloze
The "{word}" Intel data type has assembly-code suffix {`w`}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523830-->
END%%
%%ANKI
Basic
What is the width of an Intel "double word"?
Back: $32$ bits
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523833-->
END%%
%%ANKI
Basic
Which Intel data types are 4 bytes wide?
Back: The double word and single-precision.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523836-->
END%%
%%ANKI
Cloze
The "{double word/double-precision}" Intel data type has assembly-code suffix {`l`}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523839-->
END%%
%%ANKI
Basic
*Why* do double words have assembly-code suffix `l`?
Back: The suffix stands for "long", relative to a 16-bit word.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523842-->
END%%
%%ANKI
Basic
What is the width of an Intel "quad word"?
Back: $64$ bits
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523846-->
END%%
%%ANKI
Basic
Which Intel data types are 8 bytes wide?
Back: The quad word and double-precision.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523850-->
END%%
%%ANKI
Cloze
The "{quad word}" Intel data type has assembly-code suffix {`q`}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523853-->
END%%
%%ANKI
Cloze
C integral declaration {`char`} corresponds to Intel data type "{byte}".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1711116523858-->
END%%
%%ANKI
Cloze
C integral declaration {`short`} corresponds to Intel data type "{word}".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1711116523862-->
END%%
%%ANKI
Cloze
C integral declaration {`int`} corresponds to Intel data type "{double word}".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1711116523866-->
END%%
%%ANKI
Cloze
C integral declaration {`long`} corresponds to Intel data type "{quad word}".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1711116523870-->
END%%
%%ANKI
Cloze
C declaration `char *` corresponds to Intel data type "{quad word}".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1711116523874-->
END%%
%%ANKI
Cloze
C floating-point declaration {`float`} corresponds to Intel data type "{single-precision}".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1711116523877-->
END%%
%%ANKI
Cloze
The "{single-precision}" Intel data type has assembly-code suffix {`s`}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523881-->
END%%
%%ANKI
Cloze
C floating-point declaration {`double`} corresponds to Intel data type "{double-precision}".
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c17
<!--ID: 1711116523885-->
END%%
%%ANKI
Basic
What is the width of an Intel "singe precision"?
Back: $32$ bits
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523889-->
END%%
%%ANKI
Basic
What two Intel data types do floating-point numbers come in?
Back: Single-precision and double-precision.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523893-->
END%%
%%ANKI
Basic
Assembly-code suffix `l` is used for what two Intel data types?
Back: Double words and double-precisions.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523898-->
END%%
%%ANKI
Basic
What is the width of an Intel "double-precision"?
Back: $64$ bits
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523903-->
END%%
%%ANKI
Basic
Why is it safe for double words and double-precisions to both use assembly-code suffix `l`?
Back: Floating-point code uses a different set of instructions and registers.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1711116523908-->
END%%
## References
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.

View File

@ -1,16 +1,54 @@
--- ---
title: x86 title: Assembly
TARGET DECK: Obsidian::STEM TARGET DECK: Obsidian::STEM
FILE TAGS: asm::x86 FILE TAGS: x86-64
tags: tags:
- asm - x86-64
- x86
--- ---
## Overview ## Overview
x86 refers to the architecture first introduced by Intel with their 8086 processor (1978). Intel's i386 (1985), originally named the 80386, expanded the architecture to 32-bits. AMD's Opteron (2003) expanded it again to 64-bits. x86 refers to the architecture first introduced by Intel with their 8086 processor (1978). Intel's i386 (1985), originally named the 80386, expanded the architecture to 32-bits. AMD's Opteron (2003) expanded it again to 64-bits.
%%ANKI
Basic
What *is* an ISA?
Back: A specification describing how a processor behaves.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313830-->
END%%
%%ANKI
Basic
What is ISA an acronym for?
Back: **I**nstruction **s**et **a**rchitecture.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313835-->
END%%
%%ANKI
Basic
What is a microarchitecture?
Back: The way an ISA is implemented in a particular processor.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313839-->
END%%
%%ANKI
Basic
How is the term "microarchitecture" often abbreviated?
Back: uarch
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313843-->
END%%
%%ANKI
Cloze
A {microarchitecture} is an implementation of an {ISA}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313848-->
END%%
%%ANKI %%ANKI
Basic Basic
Which company invented x86? Which company invented x86?

View File

@ -0,0 +1,65 @@
---
title: Instructions
TARGET DECK: Obsidian::STEM
FILE TAGS: x86-64
tags:
- x86-64
---
## Overview
x86-64 instructions are designed so that commonly used instructions and those with fewer operands are encoded in a smaller number of bytes. Instructions range in length from 1 to 15 bytes.
x86-64 assembly comes in two flavors: ATT and Intel. ATT is most common in Linux systems so I focus on that. The most important distinction between the two is operand ordering: Intel syntax lists multiple operands in reverse order compared to ATT.
%%ANKI
Basic
x86-64 assembly comes in what two formats?
Back: ATT and Intel.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313804-->
END%%
%%ANKI
Basic
Which x86-64 assembly format does Linux use?
Back: ATT.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313810-->
END%%
%%ANKI
Basic
Which x86-64 assembly format does Microsoft use?
Back: Intel.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313814-->
END%%
%%ANKI
Basic
What is the "most confusing" difference between ATT and Intel assembly?
Back: Multiple operands in one are listed in reverse order relative to the other.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313818-->
END%%
%%ANKI
Basic
What term describes assembly lines with a leading `.`?
Back: Directives.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313822-->
END%%
%%ANKI
Basic
Assembly directives are important for what two programs?
Back: The assembler and the linker.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1710959313826-->
END%%
## References
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.