1#ifndef UINTEGER_H
2#define UINTEGER_H
3
4#include <stdbool.h>
5#include <stdio.h>
6#include <inttypes.h>
7
8struct top_uinteger {
9    bool is_negative;
10    uint64_t value;
11};
12
13struct top_uinteger top_init_uinteger(uint64_t value, bool is_negative);
14
15struct top_uinteger top_sub_uinteger(const struct top_uinteger *a, const struct top_uinteger *b);
16
17bool top_humanize_uinteger(char *buf, size_t bufsize, const struct top_uinteger i);
18
19bool top_sprint_uinteger(char *buf, size_t bufsize, struct top_uinteger i);
20
21struct top_uinteger top_uinteger_calc_result(uint64_t now, uint64_t prev,
22					     uint64_t beg);
23
24/*
25 * These return true in the case of a buffer overflow.
26 * If the value has changed since the previous sample,
27 * they will display a + or - to the right of the sample.
28 */
29bool top_uinteger_format_result(char *buf, size_t bufsize, uint64_t now,
30				uint64_t prev, uint64_t beg);
31
32bool top_uinteger_format_mem_result(char *buf, size_t bufsize, uint64_t now,
33				    uint64_t prev, uint64_t beg);
34
35#endif /*UINTEGER_H*/
36