diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-25 19:02:23 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-25 19:02:23 +0200 |
commit | 87900d6787f8e0af8d37cc313c4e0510ef0b1bf8 (patch) | |
tree | 3f5858a1d7b7291c8415d3d828321f3e20c503ad /shared/bin.c | |
parent | afa10fa556585d965e3a7d46c2fd5436d29cf3c6 (diff) |
serial receive working with empty handlers
Diffstat (limited to 'shared/bin.c')
-rw-r--r-- | shared/bin.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/shared/bin.c b/shared/bin.c index 44c2e94..dac8415 100644 --- a/shared/bin.c +++ b/shared/bin.c @@ -15,8 +15,6 @@ #define _BYTE_2 ((uint32_t)(0xff << (_SHIFT_2B))) #define _BYTE_3 ((uint32_t)(0xff << (_SHIFT_3B))) -const uint8_t W2_STRUCT_T_SIZES[] = {sizeof(uint8_t), sizeof(uint16_t), sizeof(uint32_t)}; - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshift-count-overflow" w2_s_bin *w2_bin_from_uint8_t(uint8_t data) { @@ -70,3 +68,13 @@ w2_s_bin *w2_bin_s_alloc(uint16_t bytes, uint8_t *data) { memcpy(&temp->data, data, bytes); return temp; } + +w2_s_bin *w2_bin_s_cat(w2_s_bin *a, w2_s_bin *b) { + uint8_t data[a->bytes + b->bytes]; + memcpy(data, a->data, a->bytes); + memcpy(data + a->bytes, b->data, b->bytes); + w2_s_bin* c = w2_bin_s_alloc(a->bytes + b->bytes, data); + free(a); + free(b); + return c; +} |