read morphism body definitions from morphism-base file and generate instantiations based on type-variable substitutions

This commit is contained in:
Michael Sippel 2025-02-16 17:08:55 +01:00
parent 3f4a99ad79
commit cea1f36e63
Signed by: senvas
GPG key ID: F96CF119C34B64A6
8 changed files with 244 additions and 255 deletions
morphisms/include/array

View file

@ -0,0 +1,65 @@
#pragma once
#include <stdint.h>
/* UInt8 */
struct LengthPrefixUInt8Array {
uint64_t len;
uint8_t items[];
};
void length_prefix_uint8_array_clear(
struct LengthPrefixUInt8Array * data
);
void length_prefix_uint8_array_push(
struct LengthPrefixUInt8Array * data,
uint8_t value
);
int length_prefix_uint8_array_reverse(
struct LengthPrefixUInt8Array const * restrict src,
struct LengthPrefixUInt8Array * restrict dst
);
void length_prefix_uint8_array_dump(
struct LengthPrefixUInt8Array const * data
);
/* UInt64 */
struct LengthPrefixUInt64Array {
uint64_t len;
uint64_t items[];
};
void length_prefix_uint64_array_clear(
struct LengthPrefixUInt64Array * data
);
void length_prefix_uint64_array_push(
struct LengthPrefixUInt64Array * data,
uint64_t value
);
int length_prefix_uint64_array_reverse(
struct LengthPrefixUInt64Array const * restrict src,
struct LengthPrefixUInt64Array * restrict dst
);
void length_prefix_uint64_array_dump(
struct LengthPrefixUInt64Array const * data
);
/*
* Map
*/
int length_prefix_array_map_64_to_64(
int (*f) ( uint64_t const * restrict, uint64_t * restrict ),
struct LengthPrefixUInt64Array const * restrict src,
struct LengthPrefixUInt64Array * restrict dst
);
int length_prefix_array_map_8_to_64(
int (*f) ( uint8_t const * restrict, uint64_t * restrict ),
struct LengthPrefixUInt8Array const * restrict src,
struct LengthPrefixUInt64Array * restrict dst
);
int length_prefix_array_map_64_to_8(
int (*f) ( uint64_t const * restrict, uint8_t * restrict ),
struct LengthPrefixUInt64Array const * restrict src,
struct LengthPrefixUInt8Array * restrict dst
);