mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Added rounding macros and constants to math.h
This commit is contained in:
+9
-1
@@ -1,8 +1,16 @@
|
|||||||
#ifndef MATH_H
|
#ifndef MATH_H
|
||||||
#define MATH_H
|
#define MATH_H
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
#define PI 3.141592653589 // Should be good enough
|
||||||
|
#define E 2.718281828459
|
||||||
|
|
||||||
|
// Macros
|
||||||
#define abs(x) ( (x) > 0 ? (x) : -(x) )
|
#define abs(x) ( (x) > 0 ? (x) : -(x) )
|
||||||
#define sign(x) ( (x) == 0 ? 0 : ((x) < 0 ? -1 : 1 ) )
|
#define sign(x) ( (x) == 0 ? 0 : ((x) < 0 ? -1 : 1 ) )
|
||||||
#define round(x) ( (int)((x) + 0.5) )
|
|
||||||
|
#define floor(x) ( (int)(x) ) // C floors floats when converting to ints
|
||||||
|
#define round(x) ( (int)((x) + 0.5) ) // Normal rounding
|
||||||
|
#define ceil(x) ( (int)((x) + 1) ) // Always rounds up
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
=== Todo ===
|
=== Todo ===
|
||||||
|
|
||||||
- [*] Multistage Bootloader
|
- [x] Multistage Bootloader
|
||||||
- [ ] Bootloader reads filetable to find files
|
- [ ] Bootloader reads filetable to find files
|
||||||
- [ ] Makefile refactorin'
|
- [ ] Makefile refactorin'
|
||||||
- [ ] Write down where stuff is in memory (0x1000 - kernel, 0x4000? - filetable, 0x5000 - VBE Mode Info, 0x6000 - Font)
|
- [ ] Write down where stuff is in memory (0x1000 - kernel, 0x4000? - filetable, 0x5000 - VBE Mode Info, 0x6000 - Font)
|
||||||
@@ -8,15 +8,15 @@
|
|||||||
- [ ] Scrolling
|
- [ ] Scrolling
|
||||||
- [ ] Scroll-back
|
- [ ] Scroll-back
|
||||||
- [ ] Color codes (and just multicolor text in general)
|
- [ ] Color codes (and just multicolor text in general)
|
||||||
- [*] VESA BIOS Extensions
|
- [x] VESA BIOS Extensions
|
||||||
- [*] Better resolution
|
- [x] Better resolution
|
||||||
- [*] Graphics mode
|
- [x] Graphics mode
|
||||||
- [*] Custom font
|
- [x] Custom font
|
||||||
- [*] Larger text size
|
- [x] Larger text size
|
||||||
- [ ] Variable text size :)
|
- [ ] Variable text size :)
|
||||||
- [ ] Make output overflow go to next line
|
- [ ] Make output overflow go to next line
|
||||||
- [ ] Graphics
|
- [x] Graphics
|
||||||
- [ ] Enter/exit a "graphics" mode (idk if we need this)
|
- [?] Enter/exit a "graphics" mode (idk if we need this)
|
||||||
- [x] Pixel drawing
|
- [x] Pixel drawing
|
||||||
- [x] Line drawing (Raycaster Alert??)
|
- [x] Line drawing (Raycaster Alert??)
|
||||||
- [x] Triangles (3D?!!???)
|
- [x] Triangles (3D?!!???)
|
||||||
@@ -38,17 +38,19 @@
|
|||||||
- [ ] Power
|
- [ ] Power
|
||||||
- [ ] Square Root
|
- [ ] Square Root
|
||||||
- [ ] Nth Root
|
- [ ] Nth Root
|
||||||
- [ ] Floor
|
- [x] Floor
|
||||||
- [x] Round
|
- [x] Round
|
||||||
- [ ] Ceiling
|
- [x] Ceiling
|
||||||
- [x] Sign
|
- [x] Sign
|
||||||
- [ ] INFINITY
|
- [ ] INFINITY
|
||||||
- [ ] NAN
|
- [ ] NAN
|
||||||
|
- [x] E (eulers number)
|
||||||
|
- [x] PI
|
||||||
- [ ] Filesystem
|
- [ ] Filesystem
|
||||||
- [ ] Utility for filesystem building (not just an assembly file)
|
- [ ] Utility for filesystem building (not just an assembly file)
|
||||||
- [*] Filetable
|
- [x] Filetable
|
||||||
- [ ] Files
|
- [ ] Files
|
||||||
- [*] Larger than one sector (512B)
|
- [x] Larger than one sector (512B)
|
||||||
- [ ] Any file size (Not multiples of 512B)
|
- [ ] Any file size (Not multiples of 512B)
|
||||||
- [ ] Filetypes
|
- [ ] Filetypes
|
||||||
- [ ] Directories
|
- [ ] Directories
|
||||||
@@ -68,15 +70,15 @@
|
|||||||
- [ ] ';' separated commands
|
- [ ] ';' separated commands
|
||||||
- [ ] I/O Redirection with '<' '>'
|
- [ ] I/O Redirection with '<' '>'
|
||||||
- [ ] Commands
|
- [ ] Commands
|
||||||
- [*] echo
|
- [x] echo
|
||||||
- [*] clear
|
- [x] clear
|
||||||
- [*] help
|
- [x] help
|
||||||
- [*] ls
|
- [x] ls
|
||||||
- [*] exit
|
- [x] exit
|
||||||
- [ ] touch (make file)
|
- [ ] touch (make file)
|
||||||
- [ ] rm
|
- [ ] rm
|
||||||
- [ ] mkdir (add dirs first)
|
- [ ] mkdir (add dirs first)
|
||||||
- [*] reboot
|
- [x] reboot
|
||||||
- [ ] cd
|
- [ ] cd
|
||||||
- [ ] Standard I/O stuff
|
- [ ] Standard I/O stuff
|
||||||
- [ ] stdin
|
- [ ] stdin
|
||||||
@@ -92,6 +94,7 @@
|
|||||||
- [x] Running them
|
- [x] Running them
|
||||||
- [x] Exit back to kernel/shell
|
- [x] Exit back to kernel/shell
|
||||||
- [ ] Let them use libs
|
- [ ] Let them use libs
|
||||||
|
- [ ] Proper include files (LibC?)
|
||||||
- [ ] argc, argv[]
|
- [ ] argc, argv[]
|
||||||
- [ ] Standalone shell program
|
- [ ] Standalone shell program
|
||||||
- [ ] Code Editor
|
- [ ] Code Editor
|
||||||
|
|||||||
Reference in New Issue
Block a user