'\" t .\" Title: mtbl_fixed .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 01/31/2014 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "MTBL_FIXED" "3" "01/31/2014" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" mtbl_fixed \- Fixed\-width encoding and decoding of 32 and 64 bit integers .SH "SYNOPSIS" .sp \fB#include \fR .sp \fBsize_t mtbl_fixed_encode32(uint8_t *\fR\fB\fIdst\fR\fR\fB, uint32_t \fR\fB\fIvalue\fR\fR\fB);\fR .sp \fBsize_t mtbl_fixed_encode64(uint8_t *\fR\fB\fIdst\fR\fR\fB, uint64_t \fR\fB\fIvalue\fR\fR\fB);\fR .sp \fBuint32_t mtbl_fixed_decode32(const uint8_t *\fR\fB\fIptr\fR\fR\fB);\fR .sp \fBuint64_t mtbl_fixed_decode64(const uint8_t *\fR\fB\fIptr\fR\fR\fB);\fR .SH "DESCRIPTION" .sp \fBmtbl_fixed_encode32\fR() and \fBmtbl_fixed_encode64\fR() write the 32 or 64 bit quantity, respectively, in the argument \fIvalue\fR to the buffer in the argument \fIdst\fR\&. The quantity will be written in little endian order, regardless of host architecture\&. .sp \fBmtbl_fixed_decode32\fR() and \fBmtbl_fixed_decode64\fR() read and return the 32 or 64 bit quantity, respectively, in the argument \fIptr\fR\&. The quantity will be read in little endian order, regardless of host architecture\&. .sp Bounds checking must be performed by the caller\&. .SH "RETURN VALUE" .sp \fBmtbl_fixed_encode32\fR() and \fBmtbl_fixed_encode64\fR() return the number of bytes written to the buffer\&. (4 or 8, respectively\&.) .sp \fBmtbl_fixed_decode32\fR() and \fBmtbl_fixed_decode64\fR() return the decoded quantity\&.