fumiama / bytelizer

Bytelizer is a binary packaging/unpack library written in modern c, focusing on performance and lightweight.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bytelizer

Bytelizer is a binary packaging/unpack library written in modern c,
focusing on performance and lightweight.

Feature:

  • Anchor for late data insert/fill
  • Barrier (or segment/packet)
  • Length prefix support
  • Static Protobuf structure declaration
  • Endianess

Almost all functions and variants are macrolized or inlined for compiler static optimization.

frost license

Quick Guide

typedef struct {
  uint16_t a;
  uint16_t b;
  uint32_t c;
} example_t;

// the generic way in c
example_t _example = {
  .a = 0x1234,
  .b = 0x5678,
  .c = 0xDEADBEEF
};

// the equivalent in bytelizer,
// allocates 64 bytes on the stack.
bytelizer_alloc(_ctx, 64); {
  bytelizer_put_uint16(_ctx, 0x1234);
  bytelizer_put_uint16(_ctx, 0x5678);
  bytelizer_put_uint32(_ctx, 0xDEADBEEF);
}

LICENSE

Licensed under GPLv2 with ❤.

About

Bytelizer is a binary packaging/unpack library written in modern c, focusing on performance and lightweight.

License:GNU General Public License v2.0


Languages

Language:C 97.4%Language:CMake 2.6%