[decycler] Change value type from unsigned to uintptr_t

Since the node struct is gonna be 3*sizeof(void*) bytes anyway,
change value type to use the full space available.
This commit is contained in:
Behdad Esfahbod committed 2025-02-18 20:02:56 -07:00
1 parent 1c18646dd6
commit c84e9b95be
2 files changed
+4 -6

No files matched your search

+3 -3
View File
@@ -72,7 +72,7 @@
* - ~hb_decycler_node_t() destructor: Restores the decycler object to its
* previous state by removing the node from the traversal path.
*
* - bool visit(unsigned value): Called on every node in the graph. Returns
* - bool visit(uintptr_t value): Called on every node in the graph. Returns
* true if the node is not part of a cycle, and false if it is. The value
* parameter is used to detect cycles. It's the caller's responsibility
* to ensure that the value is unique for each node in the graph.
@@ -134,7 +134,7 @@ struct hb_decycler_node_t
decycler.tortoise_asleep = !decycler.tortoise_asleep;
}
bool visit (unsigned value_)
bool visit (uintptr_t value_)
{
value = value_;
@@ -155,7 +155,7 @@ struct hb_decycler_node_t
hb_decycler_node_t *next;
} u = {nullptr};
hb_decycler_node_t *prev = nullptr;
unsigned value = (unsigned) -1;
uintptr_t value = 0;
};
#endif /* HB_DECYCLER_HH */
+1 -3
View File
@@ -226,9 +226,7 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
{
// FreeType doesn't provide a way to get the layer index, so we use the pointer
// for cycle detection.
unsigned i = (unsigned) (uintptr_t) other_paint.p;
if (unlikely (!node.visit (i)))
if (unlikely (!node.visit ((uintptr_t) other_paint.p)))
continue;
c->funcs->push_group (c->data);