SYNOPSIS

#include <mtbl.h>

size_t mtbl_fixed_encode32(uint8_t *dst, uint32_t value);

size_t mtbl_fixed_encode64(uint8_t *dst, uint64_t value);

uint32_t mtbl_fixed_decode32(const uint8_t *ptr);

uint64_t mtbl_fixed_decode64(const uint8_t *ptr);

DESCRIPTION

mtbl_fixed_encode32() and mtbl_fixed_encode64() write the 32 or 64 bit quantity, respectively, in the argument value to the buffer in the argument dst. The quantity will be written in little endian order, regardless of host architecture.

mtbl_fixed_decode32() and mtbl_fixed_decode64() read and return the 32 or 64 bit quantity, respectively, in the argument ptr. The quantity will be read in little endian order, regardless of host architecture.

Bounds checking must be performed by the caller.

RETURN VALUE

mtbl_fixed_encode32() and mtbl_fixed_encode64() return the number of bytes written to the buffer. (4 or 8, respectively.)

mtbl_fixed_decode32() and mtbl_fixed_decode64() return the decoded quantity.