Converting from int to int32_t and some cases bool.

This commit is contained in:
metallaxis committed 2026-05-07 10:36:14 +03:00
1 parent 77631299b8
commit f7680e872c
12 files changed
+51 -48

No files matched your search

+12 -7
View File
@@ -6,14 +6,19 @@
#include <stdio.h>
#include <stdlib.h>
typedef struct VisitedEntry {
int128_t a, b, c;
struct VisitedEntry* next;
} VisitedEntry;
static Node* pool = NULL;
static VisitedEntry* visited_pool = NULL;
static VisitedEntry* hash_table[HASH_SIZE] = {0};
static int pool_ptr = 0;
static int pool_capacity = 0;
static int visited_ptr = 0;
static int32_t pool_ptr = 0;
static int32_t pool_capacity = 0;
static int32_t visited_ptr = 0;
void node_pool_init(int max_nodes) {
void node_pool_init(int32_t max_nodes) {
pool_capacity = max_nodes;
pool = malloc(pool_capacity * sizeof(Node));
visited_pool = malloc(pool_capacity * sizeof(VisitedEntry));
@@ -44,7 +49,7 @@ void node_pool_destroy() {
queue_destroy();
}
int node_pool_usage() {
int32_t node_pool_usage() {
return pool_ptr;
}
@@ -98,9 +103,9 @@ void try_push_children(Node* curr) {
}
}
int visit_and_mark(int128_t a, int128_t b, int128_t c) {
bool visit_and_mark(int128_t a, int128_t b, int128_t c) {
sort_triplet(&a, &b, &c);
unsigned int h = hash_three128(a,b,c);
uint32_t h = hash_three128(a,b,c);
VisitedEntry* cur = hash_table[h];
while (cur) {
if (cur->a == a && cur->b == b && cur->c == c) return 0;