aboutsummaryrefslogtreecommitdiff
path: root/fptr_ast/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'fptr_ast/common.h')
-rw-r--r--fptr_ast/common.h31
1 files changed, 31 insertions, 0 deletions
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 <stdint.h>
+#include <stddef.h>
+
+#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 */