Converting from int to int32_t and some cases bool.
This commit is contained in:
12 files changed
+51
-48
No files matched your search
+8
-8
@@ -9,7 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int LIMIT = 0;
|
||||
int32_t LIMIT = 0;
|
||||
|
||||
typedef struct GlobalEntry {
|
||||
int128_t a, b, c;
|
||||
@@ -18,22 +18,22 @@ typedef struct GlobalEntry {
|
||||
|
||||
static GlobalEntry* global_root_table[HASH_SIZE] = {0};
|
||||
|
||||
int is_new_root(int128_t a, int128_t b, int128_t c) {
|
||||
bool is_new_root(int128_t a, int128_t b, int128_t c) {
|
||||
sort_triplet(&a, &b, &c);
|
||||
unsigned int h = hash_three128((uint128_t)a, (uint128_t)b, (uint128_t)c);
|
||||
uint32_t h = hash_three128((uint128_t)a, (uint128_t)b, (uint128_t)c);
|
||||
|
||||
GlobalEntry* cur = global_root_table[h];
|
||||
while (cur) {
|
||||
if (cur->a == a && cur->b == b && cur->c == c) return 0;
|
||||
if (cur->a == a && cur->b == b && cur->c == c) return false;
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
GlobalEntry* e = malloc(sizeof(GlobalEntry));
|
||||
if (!e) return 1; /* Fallback to running BFS if malloc fails */
|
||||
if (!e) return true; /* Fallback to running BFS if malloc fails */
|
||||
e->a = a; e->b = b; e->c = c;
|
||||
e->next = global_root_table[h];
|
||||
global_root_table[h] = e;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void clear_global_table() {
|
||||
@@ -100,8 +100,8 @@ int main() {
|
||||
}
|
||||
else if (mode == 2) {
|
||||
clear_global_table(); /* Reset unique root tracker */
|
||||
int p = 7;
|
||||
int exponents[3] = {2*p + 2, p, p};
|
||||
int32_t p = 7;
|
||||
int32_t exponents[3] = {2*p + 2, p, p};
|
||||
int128_t values[3] = {4 * power(a0, p) * power(b0, p), power(a0, p), power(b0, p)};
|
||||
generate_factor_pairs(&sum, 0, exponents, values, 1, print_mode);
|
||||
|
||||
|
||||
Reference in new issue
Block a user