aboutsummaryrefslogtreecommitdiff
path: root/include/lib/algo
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2025-03-22 22:27:40 -0700
committerChristian C <cc@localhost>2025-03-22 22:27:40 -0700
commit16422831ed49c573c1b8a43ba907bceb00fd5eea (patch)
tree1c2d86d5eecf6d1b7b4951f0b20f8c86e6939ac2 /include/lib/algo
parent123464e36f2a151d820e08db7b4b426ca2b3657a (diff)
Named Types
Diffstat (limited to 'include/lib/algo')
-rw-r--r--include/lib/algo/avl_tree.h8
-rw-r--r--include/lib/algo/flood_fill.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/include/lib/algo/avl_tree.h b/include/lib/algo/avl_tree.h
index f77ce5b..4467fd1 100644
--- a/include/lib/algo/avl_tree.h
+++ b/include/lib/algo/avl_tree.h
@@ -6,19 +6,21 @@
#include <stdlib.h>
#include <sys/types.h>
+#define AvlHeight_t uint8_t
+
struct AVLNode {
void* data;
bool_t (*compare)(void*, void*);
struct AVLNode* left;
struct AVLNode* right;
- uint8_t height;
+ AvlHeight_t height;
};
// Get the height of an AVL node
-uint8_t get_height(struct AVLNode* node);
+AvlHeight_t get_height(struct AVLNode* node);
// Get the Maximum Height between two
-uint8_t max_height(uint8_t a, uint8_t b);
+AvlHeight_t max_height(AvlHeight_t a, AvlHeight_t b);
// Get the balance factor of a node
ssize_t get_balance_factor(struct AVLNode* node);
diff --git a/include/lib/algo/flood_fill.h b/include/lib/algo/flood_fill.h
index 81ed6fd..e9872eb 100644
--- a/include/lib/algo/flood_fill.h
+++ b/include/lib/algo/flood_fill.h
@@ -3,6 +3,7 @@
#include <lib/bool.h>
#include <lib/color.h>
+#include <lib/data/image_types.h>
#include <stddef.h>
#include <stdint.h>
@@ -14,6 +15,6 @@
// 4. Check if the (x,y) coordinate in the image is the same color as the fill color
// 5. If all hold, set the label for the pixel, and check each neighbor
// Otherwise, stop flooding
-bool_t flood(uint8_t* image, uint16_t* mask, size_t width, size_t height, size_t channels, size_t x, size_t y, uint8_t* fill_color, uint16_t label);
+bool_t flood(ImageData_t* image, ImageMaskData_t* mask, size_t width, size_t height, size_t channels, size_t x, size_t y, ImageData_t* fill_color, ImageMaskData_t label);
#endif