1
0
Fork 0

Merging upstream version 2.4+really2.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:22:16 +01:00
parent 58746eb9a3
commit 1fbda9c797
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
458 changed files with 5141 additions and 7138 deletions

View file

@ -46,31 +46,14 @@ uint64_t int48_to_long(__u8 *data)
return result;
}
static long double uint128_t_to_double(nvme_uint128_t data)
{
int i;
long double result = 0;
for (i = 0; i < sizeof(data.words) / sizeof(*data.words); i++) {
result *= 4294967296;
result += data.words[i];
}
return result;
}
static char *__uint128_t_to_string(nvme_uint128_t val, bool l10n)
char *uint128_t_to_string(nvme_uint128_t val)
{
static char str[60];
int idx = 60;
__u64 div, rem;
char *sep = NULL;
int i, len = 0;
if (l10n) {
sep = localeconv()->thousands_sep;
len = strlen(sep);
}
char *sep = localeconv()->thousands_sep;
int len = sep ? strlen(sep) : 0;
int i;
/* terminate at the end, and build up from the ones */
str[--idx] = '\0';
@ -105,14 +88,17 @@ static char *__uint128_t_to_string(nvme_uint128_t val, bool l10n)
return str + idx;
}
char *uint128_t_to_string(nvme_uint128_t val)
static long double uint128_t_to_double(nvme_uint128_t data)
{
return __uint128_t_to_string(val, false);
}
int i;
long double result = 0;
char *uint128_t_to_l10n_string(nvme_uint128_t val)
{
return __uint128_t_to_string(val, true);
for (i = 0; i < sizeof(data.words) / sizeof(*data.words); i++) {
result *= 4294967296;
result += data.words[i];
}
return result;
}
char *uint128_t_to_si_string(nvme_uint128_t val, __u32 bytes_per_unit)