<commit_before>#define _DEFAULT_SOURCE

#include "evoasm-search.h"
#include "evoasm-error.h"
#include <stdalign.h>

#if 0
#ifdef __STDC_NO_THREADS__
#include "tinycthread.h"
#else
#include <threads.h>
#endif
#endif

EVOASM_DECL_LOG_TAG("search")

#define _EVOASM_KERNEL_SIZE(max_kernel_size) \
   (sizeof(evoasm_kernel_params_t) + \
    (max_kernel_size) * sizeof(evoasm_kernel_param_t))

#define _EVOASM_ADF_SIZE(max_adf_size, max_kernel_size) \
  (sizeof(evoasm_adf_params_t) + \
   (max_adf_size) * _EVOASM_KERNEL_SIZE(max_kernel_size))

#define _EVOASM_SEARCH_ADF_PARAMS(search, adfs, adf_index) \
  ((evoasm_adf_params_t *)((unsigned char *)(adfs) + (adf_index) * _EVOASM_ADF_SIZE(search->params.max_adf_size, search->params.max_kernel_size)))

#define _EVOASM_ADF_PARAMS_KERNEL_PARAMS(adf_params, max_kernel_size, kernel_index) \
  ((evoasm_kernel_params_t *)((unsigned char *)(adf_params) + sizeof(evoasm_adf_params_t) + (kernel_index) * _EVOASM_KERNEL_SIZE(max_kernel_size)))

#define EVOASM_ADF_OUTPUT_VALS_SIZE(io) \
      ((size_t)EVOASM_ADF_IO_N_EXAMPLES(io) * \
       (size_t)EVOASM_KERNEL_MAX_OUTPUT_REGS * \
       sizeof(evoasm_example_val_t))

#if (defined(__unix__) || defined(__unix) ||\
    (defined(__APPLE__) && defined(__MACH__)))

#define EVOASM_SEARCH_PROLOG_EPILOG_SIZE UINT32_C(1024)

#include <setjmp.h>
#include <stdio.h>
#include <signal.h>
#include <stdatomic.h>

#define _EVOASM_SIGNAL_CONTEXT_TRY(signal_ctx) (sigsetjmp((signal_ctx)->env, 1) == 0)
#define _EVOASM_SEARCH_EXCEPTION_SET_P(exc) (_evoasm_signal_ctx->exception_mask & (1 << exc))

struct evoasm_signal_context {<commit_msg>Add __linux__ in case __unix__ is not defined<commit_after>#define _DEFAULT_SOURCE

#include "evoasm-search.h"
#include "evoasm-error.h"
#include <stdalign.h>

#if 0
#ifdef __STDC_NO_THREADS__
#include "tinycthread.h"
#else
#include <threads.h>
#endif
#endif

EVOASM_DECL_LOG_TAG("search")

#define _EVOASM_KERNEL_SIZE(max_kernel_size) \
   (sizeof(evoasm_kernel_params_t) + \
    (max_kernel_size) * sizeof(evoasm_kernel_param_t))

#define _EVOASM_ADF_SIZE(max_adf_size, max_kernel_size) \
  (sizeof(evoasm_adf_params_t) + \
   (max_adf_size) * _EVOASM_KERNEL_SIZE(max_kernel_size))

#define _EVOASM_SEARCH_ADF_PARAMS(search, adfs, adf_index) \
  ((evoasm_adf_params_t *)((unsigned char *)(adfs) + (adf_index) * _EVOASM_ADF_SIZE(search->params.max_adf_size, search->params.max_kernel_size)))

#define _EVOASM_ADF_PARAMS_KERNEL_PARAMS(adf_params, max_kernel_size, kernel_index) \
  ((evoasm_kernel_params_t *)((unsigned char *)(adf_params) + sizeof(evoasm_adf_params_t) + (kernel_index) * _EVOASM_KERNEL_SIZE(max_kernel_size)))

#define EVOASM_ADF_OUTPUT_VALS_SIZE(io) \
      ((size_t)EVOASM_ADF_IO_N_EXAMPLES(io) * \
       (size_t)EVOASM_KERNEL_MAX_OUTPUT_REGS * \
       sizeof(evoasm_example_val_t))

#if (defined(__linux__) || defined(__unix__) || defined(__unix) ||\
    (defined(__APPLE__) && defined(__MACH__)))

#define EVOASM_SEARCH_PROLOG_EPILOG_SIZE UINT32_C(1024)

#include <setjmp.h>
#include <stdio.h>
#include <signal.h>
#include <stdatomic.h>

#define _EVOASM_SIGNAL_CONTEXT_TRY(signal_ctx) (sigsetjmp((signal_ctx)->env, 1) == 0)
#define _EVOASM_SEARCH_EXCEPTION_SET_P(exc) (_evoasm_signal_ctx->exception_mask & (1 << exc))

struct evoasm_signal_context {
{'fraction_non_alphanumeric': 0.1275820170109356, 'fraction_numerical': 0.006075334143377886, 'mean_word_length': 7.3578680203045685, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7419223', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1377, 'n_words': 180}