2022-07-04 18:04:08 +02:00
|
|
|
#ifndef MD2_COMMON_H
|
|
|
|
#define MD2_COMMON_H
|
|
|
|
|
2022-07-20 10:36:19 +02:00
|
|
|
#include <errno.h>
|
2022-07-04 18:04:08 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2022-07-20 17:46:35 +02:00
|
|
|
#include "../helper.h"
|
|
|
|
|
|
|
|
#ifdef MD2_DETAILED_BENCHMARK
|
|
|
|
#define md2_process_detailed_benchmark_step_if_defined(step) \
|
|
|
|
md2_process_detailed_benchmark_step(step);
|
|
|
|
|
|
|
|
#define md2_print_detailed_benchmark_result_if_defined \
|
|
|
|
md2_print_detailed_benchmark_result();
|
|
|
|
#else
|
|
|
|
#define md2_process_detailed_benchmark_step_if_defined(step)
|
|
|
|
#define md2_print_detailed_benchmark_result_if_defined
|
|
|
|
#endif // MD2_DETAILED_BENCHMARK
|
|
|
|
|
|
|
|
#define CHECKSUM_START_MARK \
|
|
|
|
md2_process_detailed_benchmark_step_if_defined(CHECKSUM_START)
|
|
|
|
#define CHECKSUM_END_MARK \
|
|
|
|
md2_process_detailed_benchmark_step_if_defined(CHECKSUM_END)
|
|
|
|
#define FIRST_LOOP_START_MARK \
|
|
|
|
md2_process_detailed_benchmark_step_if_defined(FIRST_LOOP_START)
|
|
|
|
#define FIRST_LOOP_END_MARK \
|
|
|
|
md2_process_detailed_benchmark_step_if_defined(FIRST_LOOP_END)
|
|
|
|
#define SECOND_LOOP_START_MARK \
|
|
|
|
md2_process_detailed_benchmark_step_if_defined(SECOND_LOOP_START)
|
|
|
|
#define SECOND_LOOP_END_MARK \
|
|
|
|
md2_process_detailed_benchmark_step_if_defined(SECOND_LOOP_END)
|
|
|
|
#define END_MARK md2_print_detailed_benchmark_result_if_defined
|
|
|
|
|
|
|
|
enum md2_detailed_benchmark_step {
|
|
|
|
CHECKSUM_START = 0,
|
|
|
|
CHECKSUM_END,
|
|
|
|
FIRST_LOOP_START,
|
|
|
|
FIRST_LOOP_END,
|
|
|
|
SECOND_LOOP_START,
|
|
|
|
SECOND_LOOP_END
|
|
|
|
};
|
|
|
|
|
2022-07-04 18:04:08 +02:00
|
|
|
/**
|
|
|
|
* @brief Some digits of pi
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern unsigned char MD2_PI_SUBST[256];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Print a buffer for debugging
|
|
|
|
*
|
|
|
|
* @param len length
|
|
|
|
* @param buf buffer
|
|
|
|
*/
|
|
|
|
void md2_print_buf(size_t len, uint8_t buf[len]);
|
|
|
|
|
2022-07-20 17:46:35 +02:00
|
|
|
void md2_process_detailed_benchmark_step(enum md2_detailed_benchmark_step step);
|
|
|
|
|
|
|
|
void md2_print_detailed_benchmark_result();
|
|
|
|
|
2022-07-04 18:04:08 +02:00
|
|
|
#endif // MD2_COMMON_H
|