]> git.ipfire.org Git - thirdparty/lldpd.git/blame - src/lib/fixedpoint.h
tests: fix skip instruction
[thirdparty/lldpd.git] / src / lib / fixedpoint.h
CommitLineData
f730f6c5
VB
1/* -*- mode: c; c-file-style: "openbsd" -*- */
2/*
3 * Copyright (c) 2012 Vincent Bernat <bernat@luffy.cx>
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#if HAVE_CONFIG_H
19# include <config.h>
20#endif
21
22#if ! defined FIXEDPOINT_H && defined ENABLE_LLDPMED
23#define FIXEDPOINT_H
24
25struct fp_number {
26 struct {
27 long long value;
28 unsigned bits;
29 } integer;
30 struct {
31 long long value;
32 unsigned bits;
33 unsigned precision;
34 } fraction;
35};
36struct fp_number fp_strtofp(const char *, char **, unsigned, unsigned);
37struct fp_number fp_buftofp(const unsigned char *, unsigned, unsigned, unsigned);
38struct fp_number fp_negate(struct fp_number);
39char *fp_fptostr(struct fp_number, const char *);
40void fp_fptobuf(struct fp_number, unsigned char *, unsigned);
41
42#endif