ldmc/morphisms/runtime/include/array/length-prefix.h
Michael Sippel 630948139b
move header & library for morphism data structures to 'runtime' diretcory
- adapt Makefile for code size benchmark
- write build files to 'target' directory
2025-03-15 18:45:52 +01:00

70 lines
1.9 KiB
C

#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
);
int length_prefix_array_map_8_to_8(
int (*f) ( uint8_t const * restrict, uint8_t * restrict ),
struct LengthPrefixUInt8Array const * restrict src,
struct LengthPrefixUInt8Array * restrict dst
);