33 lines
1.5 kB
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* dispatch.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: ohaponiu <marvin@42.fr> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2026/04/28 12:46:10 by ohaponiu #+# #+# */
9/* Updated: 2026/05/04 13:16:36 by ohaponiu ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "metrics.h"
14#include "strategies.h"
15
16void dispatch(t_context *ctx)
17{
18 if (ctx->flags.strategy == STRAT_SIMPLE)
19 sort_insert(&ctx->a, &ctx->b, &ctx->ops);
20 else if (ctx->flags.strategy == STRAT_MEDIUM)
21 sort_chunk(&ctx->a, &ctx->b, &ctx->ops);
22 else if (ctx->flags.strategy == STRAT_COMPLEX)
23 sort_turk(&ctx->a, &ctx->b, &ctx->ops);
24 else
25 {
26 if (ctx->disorder < DISORDER_20)
27 sort_insert(&ctx->a, &ctx->b, &ctx->ops);
28 else if (ctx->disorder < DISORDER_50)
29 sort_chunk(&ctx->a, &ctx->b, &ctx->ops);
30 else
31 sort_turk(&ctx->a, &ctx->b, &ctx->ops);
32 }
33}