From a0c6ff2c222beb72493f2e40ed27492061dfdf22 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 31 Aug 2025 14:25:07 +0300 Subject: initial fptr ast programs --- fptr_ast/common.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 fptr_ast/common.h (limited to 'fptr_ast/common.h') diff --git a/fptr_ast/common.h b/fptr_ast/common.h new file mode 100644 index 0000000..4812b59 --- /dev/null +++ b/fptr_ast/common.h @@ -0,0 +1,31 @@ +#ifndef COMMON_H +#define COMMON_H + +#include +#include + +#define MATRIX_SIZE 100 + +static inline void init_matrices(intptr_t *A, intptr_t *B) +{ + int counter = 0; + for (size_t i = 0; i < MATRIX_SIZE; ++i) + for (size_t j = 0; j < MATRIX_SIZE; ++j) { + A[i * MATRIX_SIZE + j] = counter; + B[i * MATRIX_SIZE + j] = counter; + counter++; + } +} + +static inline size_t hash(intptr_t *C) +{ + size_t h = 0; + for (size_t i = 0; i < MATRIX_SIZE; ++i) + for (size_t j = 0; j < MATRIX_SIZE; ++j) { + h += C[i * MATRIX_SIZE + j]; + } + + return h; +} + +#endif /* COMMON_H */ -- cgit v1.2.3