commit 4d409d3106d8382f61f2bd2d80e913458dc991c3 Author: yenru0 Date: Thu Sep 18 14:39:12 2025 +0900 initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3636fc2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +[attr]lfs-file filter=lfs diff=lfs merge=lfs -text + +"*.pdf" lfs-file \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07cc0ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +.venv \ No newline at end of file diff --git a/notes/1.md b/notes/1.md new file mode 100644 index 0000000..609686c --- /dev/null +++ b/notes/1.md @@ -0,0 +1,61 @@ + +# Bits, Bytes, and Integers + +## Integers + +### Representation + +### Conversion + +**Mapping Between `signed` and `unsigned`** + +Maintain bit pattern + +so the conversion of negative value of the signed or value over the T_MAX results different interpreted value. + +### Expanding, Truncating + +**expanding of $w$-bit signed integer** + +$X = x_{w-1}x_{w-2}\cdots x_0$ +where $s = x_{w-1}$ + +expanding it to $w+k$-bit signed int: + +$X = s_{k}s_{k-1} \cdots s_1 x_{w-1}\cdots x_0,\quad \text{where}\, s_i = s$ + +**truncation of $w$-bit signed integer** + +first $k$ bit change + +## C Puzzle + +```c + +int x = foo(); +int y = bar(); + +unsigned ux = x; +unsigned uy = y; +``` + +* `x < 0` -> `((x*2) < 0)` + * `false`: underflow +* `ux >= 0` + * it's converted to `ux >= 0u` so `true` for all ux +* `x & 7 == 7` -> `(x << 30) < 0` + * `true` +* `ux > -1` + * `always false`, `-1 = uint_max` +* `x > y` -> `-x < -y` + * `false` +* `x * x >= 0` + * `false` +* `x > 0 && y > 0` -> `x + y > 0` +* `x >= 0` -> `-x <= 0` +* `x <= 0` -> `-x >= 0` +* `(x|-x) >> 31 == -1` +* `ux >> 3 == ux/8` +* `x >> 3 == x/8` +* `x & (x-1) != 0` + * `true` \ No newline at end of file diff --git a/pdf/A1.pdf b/pdf/A1.pdf new file mode 100644 index 0000000..78abecd --- /dev/null +++ b/pdf/A1.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f78e4ca301877bd2fecd6379871efcae98383508f5ee47592f2eabbe5bd8b446 +size 1274106 diff --git a/pdf/L0.pdf b/pdf/L0.pdf new file mode 100644 index 0000000..76ad517 --- /dev/null +++ b/pdf/L0.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5abb4afeb38a02b18e04a6c1c6db6ba8f443fbc3973c3d35e9c7572acc255b9e +size 466558 diff --git a/pdf/L1.pdf b/pdf/L1.pdf new file mode 100644 index 0000000..560892b --- /dev/null +++ b/pdf/L1.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b7e16f498a625132627b073f54aadacdf00766146db7c1179fe8fc85b246f6b +size 3238525 diff --git a/pdf/L2.pdf b/pdf/L2.pdf new file mode 100644 index 0000000..c615e99 --- /dev/null +++ b/pdf/L2.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a7f24edc5e873b1ac6f9ed23387a16da77cabc8790852f0ddab76f41e403e5a +size 854540 diff --git a/pdf/P0_GitLab.pdf b/pdf/P0_GitLab.pdf new file mode 100644 index 0000000..91f67ab --- /dev/null +++ b/pdf/P0_GitLab.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60a8875278e619fc747ad80aaddc1693004f4ecbe9e12abaaafb246aeefcf91d +size 660181 diff --git a/pdf/P0_VBox.pdf b/pdf/P0_VBox.pdf new file mode 100644 index 0000000..89f709a --- /dev/null +++ b/pdf/P0_VBox.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c14a5e3d20d63c949e544903708be61a5ff07e81e8bcc39dcc702a7eb9bb1e4 +size 3784553 diff --git a/pdf/P1.pdf b/pdf/P1.pdf new file mode 100644 index 0000000..4e3181b --- /dev/null +++ b/pdf/P1.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9caf85ca509774b011f5cb19d81343e6c3ce1d0d7a6674b2545fa94847e3b9f1 +size 177335