From e701f96b3799a88a81ecc62c087e33547d8b2433 Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 26 Nov 2020 16:01:38 +0000 Subject: [PATCH] begin possible work --- lean/include/work.h | 50 +++++++++++++++++++++++++++++++++++++++++++++ lean/src/main.c | 1 + lean/src/work.cpp | 8 ++++++++ 3 files changed, 59 insertions(+) create mode 100644 lean/include/work.h create mode 100644 lean/src/work.cpp diff --git a/lean/include/work.h b/lean/include/work.h new file mode 100644 index 0000000..2992a7a --- /dev/null +++ b/lean/include/work.h @@ -0,0 +1,50 @@ +#ifndef _WORK_H +#define _WORK_H + +#ifdef __cplusplus +extern "C" { +#endif + +enum work_buffer_opts { + WORK_BO_CPIP=0, // Copy then run in place on output file (default) + WORK_BO_BUFFERED=1, // Read whole input into memory then perform +}; + +typedef struct { + enum { + OP_SHUFFLE_IP, // Shuffle in place + OP_SHUFFLE_OP, // Shuffle out of place + + OP_UNSHUFFLE_IP, // Unshuffle in place + OP_UNSHUFFLE_OP, // Unshuffle out of place + } op; + union { + struct { + const char* file; + } op_shuffle_ip; + + struct { + enum work_buffer_opts buffered; + const char* ifile; + const char* ofile; + } op_shuffle_op; + + struct { + const char* file; + } op_unshuffle_ip; + + struct { + enum work_buffer_opts buffered; + const char* ifile; + const char* ofile; + } op_unshuffle_op; + } data; +} work_args_t; + +int do_work(work_args_t args); + +#ifdef __cplusplus +} +#endif + +#endif /* _WORK_H */ diff --git a/lean/src/main.c b/lean/src/main.c index 6c8ed5e..2452690 100644 --- a/lean/src/main.c +++ b/lean/src/main.c @@ -9,6 +9,7 @@ #include #include #include +#include _Static_assert(sizeof(float)==sizeof(uint32_t), "float is not 32 bits"); diff --git a/lean/src/work.cpp b/lean/src/work.cpp new file mode 100644 index 0000000..f0cf1b0 --- /dev/null +++ b/lean/src/work.cpp @@ -0,0 +1,8 @@ +#include +#include + +extern "C" int do_work(work_args_t args) +{ + //TODO: Delegate work + return 0; +}