aboutsummaryrefslogtreecommitdiff
path: root/shell/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/shell.c')
-rw-r--r--shell/shell.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/shell/shell.c b/shell/shell.c
index 0e624c9..698252d 100644
--- a/shell/shell.c
+++ b/shell/shell.c
@@ -14,6 +14,13 @@
14#define SOLUTIONS_BUFFER_SIZE UINT64_C(500000) 14#define SOLUTIONS_BUFFER_SIZE UINT64_C(500000)
15#define MAX_PATH_LENGTH UINT64_C(10000) 15#define MAX_PATH_LENGTH UINT64_C(10000)
16 16
17#if defined(_WIN32)
18#define wrap_aligned_alloc(align, size) malloc(size)
19#else
20#define wrap_aligned_alloc(align, size) \
21 (((size) % (align) == 0) ? aligned_alloc((align), (size)) : malloc(size))
22#endif
23
17#define FLAG_CUBE "-cube" 24#define FLAG_CUBE "-cube"
18#define FLAG_COMMAND "-command" 25#define FLAG_COMMAND "-command"
19#define FLAG_STR_CUBE "-cubestr" 26#define FLAG_STR_CUBE "-cubestr"
@@ -348,7 +355,7 @@ gendata_exec(args_t *args)
348 return -2; 355 return -2;
349 } 356 }
350 357
351 buf = malloc(size); 358 buf = wrap_aligned_alloc((size_t)64, size);
352 359
353 ret = nissy_gendata(args->str_solver, size, buf); 360 ret = nissy_gendata(args->str_solver, size, buf);
354 if (ret < 0) { 361 if (ret < 0) {
@@ -448,7 +455,7 @@ solve_exec(args_t *args)
448 if (args->maxsolutions == 0) 455 if (args->maxsolutions == 0)
449 args->maxsolutions = args->optimal == 20 ? 1 : UINT_MAX; 456 args->maxsolutions = args->optimal == 20 ? 1 : UINT_MAX;
450 457
451 buf = malloc(size); 458 buf = wrap_aligned_alloc((size_t)64, size);
452 read = fread(buf, size, 1, file); 459 read = fread(buf, size, 1, file);
453 fclose(file); 460 fclose(file);
454 if (read != 1) { 461 if (read != 1) {

Generated with cgit - Back to sebastiano.tronto.net