-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNOTES.c
More file actions
36 lines (32 loc) · 1.17 KB
/
NOTES.c
File metadata and controls
36 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Example:
* size x 10, pos x 5
* print 10 chars, pos x 15
* term.pos.x = 5 (15 % 10 = 5)
*/
/* Example:
* size x 10, pos x 1, size y 10, pos y 0
* prints 8 characters, pos x 9 (pos x + printed = 9)
* Formula: (new pos x % size x = new pos x)
* term.pos.x = 5 (9 % 10 = 0.something, size_t 0.8 or 0.8 = 1)
* this needs a separate case, or y will be incorrect
*/
/* Example:
* size x 10, pos x 5, size y 10, pos y 1
* print 25 chars, pos x 30 (pos x + printed = 30)
* Formula: (new pos x / size x = float coerced to int/size_t)
* term.pos.y = (30 / 10 = 3, (size_t)3 = 3)
*/
/* Example:
* size x 10, pos x 5, size y 10, pos y 0
* print 30 chars, pos x 35 (pos x + printed = 35)
* Formula: (new pos x / size x = float coerced to int/size_t)
* term.pos.y = (35 / 10 = 3.5, (size_t)3.5 = 3)
*/
/* Example:
* size x 10, pos x 5, size y 10, pos y 0
* print 10 chars, pos x 15
* Formula: (new pos x % size x = new pos x)
* term.pos.x = 5 (15 % 10 = 5)
* Formula: (new pos x / size x = float coerced to int/size_t)
* term.pos.y = 1 (15 / 10 = 1.5, (size_t)1.5 = 1)
*/