66 lines
No EOL
1.7 KiB
C
66 lines
No EOL
1.7 KiB
C
#ifndef MD2_COMMON_H
|
|
#define MD2_COMMON_H
|
|
|
|
#include <errno.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
|
|
#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
|
|
};
|
|
|
|
/**
|
|
* @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]);
|
|
|
|
void md2_process_detailed_benchmark_step(enum md2_detailed_benchmark_step step);
|
|
|
|
void md2_print_detailed_benchmark_result();
|
|
|
|
#endif // MD2_COMMON_H
|