From 8352e8d61e11a116f27a5865ee47da36f0c146c9 Mon Sep 17 00:00:00 2001 From: Yashar Alan Zenker Date: Sat, 4 Jul 2026 19:31:58 +0200 Subject: [PATCH] Fixed warning and inconsistencies --- Implementierung/tricorn_V4.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Implementierung/tricorn_V4.c b/Implementierung/tricorn_V4.c index 26cc286..2cd7bab 100644 --- a/Implementierung/tricorn_V4.c +++ b/Implementierung/tricorn_V4.c @@ -1,6 +1,6 @@ #include "tricorn_V4.h" -static void compute(void * args); +static void* compute(void * args); static unsigned converge(float c_real, float c_imag, unsigned n); static size_t get_thread_count(); typedef struct { @@ -29,17 +29,16 @@ typedef struct { */ void tricorn_V4(float complex start, size_t width, ssize_t height, float res, unsigned n, _Bool color, unsigned char* img){ - const ssize_t min_pixels_per_thread = 50; + const ssize_t min_rows_per_thread = 10; _Bool flipped = height < 0; - height = flipped ? -height : height; + size_t abs_height = flipped ? -height : height; size_t thread_count = get_thread_count(); - if(height >= min_pixels_per_thread) - while((height/thread_count) < min_pixels_per_thread) thread_count--; + if(height >= min_rows_per_thread) + while((height/thread_count) < min_rows_per_thread) thread_count--; else thread_count = 1; - printf("%lu \n",thread_count); const size_t y_step = (height+thread_count-1)/thread_count; const float start_r = crealf(start); @@ -53,7 +52,7 @@ void tricorn_V4(float complex start, size_t width, ssize_t height, float res, un args->start_r =start_r; args->start_i =start_i-i*directional_res*y_step; args->start_row = i*y_step; - args->stop_row = height < (args->start_row+y_step) ? height: (args->start_row+y_step); + args->stop_row = abs_height < (args->start_row+y_step) ? abs_height: (args->start_row+y_step); args->width = width; args-> flipped = flipped; args->color = color; @@ -66,14 +65,14 @@ void tricorn_V4(float complex start, size_t width, ssize_t height, float res, un args = NULL; } } - for(int i = 0; i < thread_count; i++){ + for(size_t i = 0; i < thread_count; i++){ pthread_join(threads[i],NULL); } return; } -static void compute(void * vargs){ +static void* compute(void * vargs){ compute_args *args = vargs; vargs = NULL; @@ -170,6 +169,7 @@ static void compute(void * vargs){ } free(args); args = NULL; + return NULL; } // Iterative application of the equation given by the assignment