add length_prefix_array_map_8_to_8
This commit is contained in:
parent
d6107601a6
commit
b88251b9c4
3 changed files with 24 additions and 9 deletions
morphisms
|
@ -63,3 +63,8 @@ int length_prefix_array_map_64_to_8(
|
|||
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
|
||||
);
|
||||
|
|
|
@ -28,6 +28,21 @@ int length_prefix_uint64_array_reverse(
|
|||
return 0;
|
||||
}
|
||||
|
||||
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
|
||||
) {
|
||||
dst->len = src->len;
|
||||
for( uint64_t i = 0; i < src->len; ++i ) {
|
||||
int result = f( &src->items[i], &dst->items[i] );
|
||||
if( result ) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int length_prefix_array_map_64_to_64(
|
||||
int (*f) ( uint64_t const * restrict, uint64_t * restrict ),
|
||||
struct LengthPrefixUInt64Array const * restrict src,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue