Math docs, add spacing to binstr_to_int

This commit is contained in:
2023-07-12 11:45:30 -07:00
parent a029765cf4
commit db44dc5a31
11 changed files with 79 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# lfbinarytree
# binarytree
Binary tree with standard leaf operations

View File

@ -1,4 +1,4 @@
# lfbool
# bool
Macro representation of truthy values

View File

@ -1,4 +1,4 @@
# lfinput
# input
I/O module to assist with consuming data from files

View File

@ -1,4 +1,4 @@
# lflinkedlist
# linkedlist
A dual sided linked list structure. Used as the foundation for many of the structures in `libflint`

View File

@ -1,3 +1,59 @@
# lfmath
# math
Coming soon
General math functions
## Functions
## max_int
Return the maximum integer between `int a` and `int b`
```c
int max_int(int a, int b);
```
## min_int
Return the minimum integer between `int a` and `int b`
```c
int min_int(int a, int b);
```
## clamp_int
Clamps an integer between a high and low value
```c
int clamp_int(int i, int low, int high);
```
## binstr_to_int
Converts a string representing a binary number into an integer. Supports underscores as spacing
```c
int binstr_to_int(const char *s);
/* Usage */
int a = binstr_to_int("10011101");
int b = binstr_to_int("1001_1101_0010_1011");
```
## bresenham
Uses bresenham's line algorithim to generate a line in 2D space.
Returns a pointer to an array of `Point`.
The `sz` parameter holds the size of the array.
```c
Point *bresenham(int x0, int y0, int x1, int y1, size_t *sz);
```
## bresenham_p
Works the same as `bresenham()` but uses the `Point` struct instead of `int`
```c
Point *bresenham_p(Point p1, Point p2, size_t *sz);
```

View File

@ -1,3 +1,3 @@
# lfset
# set
Coming soon

View File

@ -1,3 +1,3 @@
# lfstack
# stack
Coming soon

View File

@ -1,4 +1,4 @@
# lfutility
# utility
Utility code that does not fit anywhere else