mailing list of musl libc
 help / color / mirror / code / Atom feed
d6d2421140d307241cafcc8a48396efbd0065d67 blob 443 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
#include <math.h>
#include "libm.h"

#if __riscv_flen >= 64

double round(double x)
{
	if (((asuint64(x) >> 52) & 0x7ff) >= 52+0x3ff) return x;
	double tmp;
	long long n;
	__asm__ ("fcvt.l.d %0, %1, rmm" : "=r"(n) : "f"(x));
	__asm__ ("fcvt.d.l %0, %1" : "=f"(tmp) : "r"(n));
	// the sign bit is only copied to handle round(-0.0)
	__asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(tmp), "f"(x));
	return x;
}

#else

#include "../round.c"

#endif
debug log:

solving d6d24211 ...
found d6d24211 in https://inbox.vuxu.org/musl/20240614064934.657405-1-mzh@mzh.io/

applying [1/1] https://inbox.vuxu.org/musl/20240614064934.657405-1-mzh@mzh.io/
diff --git a/src/math/riscv64/round.c b/src/math/riscv64/round.c
new file mode 100644
index 00000000..d6d24211

Checking patch src/math/riscv64/round.c...
Applied patch src/math/riscv64/round.c cleanly.

index at:
100644 d6d2421140d307241cafcc8a48396efbd0065d67	src/math/riscv64/round.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).