mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-30 07:06:12 +03:00
ffa3996a5e
* clang-format: AllowShortEnumsOnASingleLine: false * clang-format: InsertNewlineAtEOF: true * clang-format: Standard: c++20 * clang-format: AlignConsecutiveBitFields * clang-format: AlignConsecutiveMacros * clang-format: RemoveParentheses: ReturnStatement * clang-format: RemoveSemicolon: true * Restored RemoveParentheses: Leave, retained general changes for it * formatting: fixed logging TAGs * Formatting update for dev Co-authored-by: あく <alleteam@gmail.com>
36 lines
849 B
C
36 lines
849 B
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* Pack uint32 to varint
|
|
* @param value value from UINT32_MIN to UINT32_MAX
|
|
* @param output output array, need to be at least 5 bytes long
|
|
* @return size_t
|
|
*/
|
|
size_t varint_uint32_pack(uint32_t value, uint8_t* output);
|
|
|
|
size_t varint_uint32_unpack(uint32_t* value, const uint8_t* input, size_t input_size);
|
|
|
|
size_t varint_uint32_length(uint32_t value);
|
|
|
|
/**
|
|
* Pack int32 to varint
|
|
* @param value value from (INT32_MIN / 2 + 1) to INT32_MAX
|
|
* @param output output array, need to be at least 5 bytes long
|
|
* @return size_t
|
|
*/
|
|
size_t varint_int32_pack(int32_t value, uint8_t* output);
|
|
|
|
size_t varint_int32_unpack(int32_t* value, const uint8_t* input, size_t input_size);
|
|
|
|
size_t varint_int32_length(int32_t value);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|