Skip to content

Commit

Permalink
add macro definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
ssp97 authored and TheSnowfield committed Dec 2, 2024
1 parent 9cf68b1 commit b092f21
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ typedef void (* bytelizer_callback_copy_t)(void* userdata, uint8_t* buffer, size
#define bytelizer_put_int8(ctx, value) \
bytelizer_put_value(ctx, int8_t, value)

/**
* @brief get int8_t from the buffer as platform endianness
* @param ctx the bytelizer context
* @param value the value
*/
#define bytelizer_get_int8(ctx, value) \
bytelizer_get_value(ctx, int8_t, value)

/**
* @brief put int16 into the buffer as platform endianness
* @param ctx the bytelizer context
Expand All @@ -253,6 +261,14 @@ typedef void (* bytelizer_callback_copy_t)(void* userdata, uint8_t* buffer, size
#define bytelizer_put_int16(ctx, value) \
bytelizer_put_value(ctx, int16_t, value)

/**
* @brief get int16_t from the buffer as platform endianness
* @param ctx the bytelizer context
* @param value the value
*/
#define bytelizer_get_int16(ctx, value) \
bytelizer_get_value(ctx, int16_t, value)

/**
* @brief put int32 into the buffer as platform endianness
* @param ctx the bytelizer context
Expand All @@ -261,6 +277,15 @@ typedef void (* bytelizer_callback_copy_t)(void* userdata, uint8_t* buffer, size
#define bytelizer_put_int32(ctx, value) \
bytelizer_put_value(ctx, int32_t, value)

/**
* @brief get int32_t from the buffer as platform endianness
* @param ctx the bytelizer context
* @param value the value
*/
#define bytelizer_get_int32(ctx, value) \
bytelizer_get_value(ctx, int32_t, value)


/**
* @brief put int64 into the buffer as platform endianness
* @param ctx the bytelizer context
Expand All @@ -269,6 +294,14 @@ typedef void (* bytelizer_callback_copy_t)(void* userdata, uint8_t* buffer, size
#define bytelizer_put_int64(ctx, value) \
bytelizer_put_value(ctx, int64_t, value)

/**
* @brief get int64_t from the buffer as platform endianness
* @param ctx the bytelizer context
* @param value the value
*/
#define bytelizer_get_int64(ctx, value) \
bytelizer_get_value(ctx, int64_t, value)

/**
* @brief put float into the buffer as platform endianness
* @param ctx the bytelizer context
Expand Down

0 comments on commit b092f21

Please sign in to comment.