parse-util: prefix load average macros with LOAD_AVG_

Follow-up for #20839
This commit is contained in:
Luca Boccassi
2021-09-27 20:34:41 +02:00
committed by Lennart Poettering
parent 49e9218ae3
commit 3542da2442
6 changed files with 51 additions and 51 deletions
+4 -4
View File
@@ -138,10 +138,10 @@ int parse_oom_score_adjust(const char *s, int *ret);
/* Implement floating point using fixed integers, to improve performance when
* calculating load averages. These macros can be used to extract the integer
* and decimal parts of a value. */
#define PRECISION_BITS 11
#define FIXED_POINT_1_0 (1 << PRECISION_BITS)
#define INT_SIDE(x) ((x) >> PRECISION_BITS)
#define DECIMAL_SIDE(x) INT_SIDE(((x) & (FIXED_POINT_1_0 - 1)) * 100)
#define LOADAVG_PRECISION_BITS 11
#define LOADAVG_FIXED_POINT_1_0 (1 << LOADAVG_PRECISION_BITS)
#define LOADAVG_INT_SIDE(x) ((x) >> LOADAVG_PRECISION_BITS)
#define LOADAVG_DECIMAL_SIDE(x) LOADAVG_INT_SIDE(((x) & (LOADAVG_FIXED_POINT_1_0 - 1)) * 100)
/* Given a Linux load average (e.g. decimal number 34.89 where 34 is passed as i and 89 is passed as f), convert it
* to a loadavg_t. */