mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
util/half: Add double_to_float16_ru/rd helpers
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41295>
This commit is contained in:
parent
7e26f9e2a9
commit
4084f6900e
2 changed files with 22 additions and 0 deletions
|
|
@ -223,6 +223,18 @@ _mesa_double_to_float16_rtz(double val)
|
|||
return _mesa_float_to_float16_rtz(_mesa_reduce_double_for_f16(val));
|
||||
}
|
||||
|
||||
static inline uint16_t
|
||||
_mesa_double_to_float16_ru(double val)
|
||||
{
|
||||
return _mesa_float_to_float16_ru(_mesa_reduce_double_for_f16(val));
|
||||
}
|
||||
|
||||
static inline uint16_t
|
||||
_mesa_double_to_float16_rd(double val)
|
||||
{
|
||||
return _mesa_float_to_float16_rd(_mesa_reduce_double_for_f16(val));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mesa
|
||||
|
|
|
|||
|
|
@ -539,3 +539,13 @@ TEST(double_to_float16_rtz, rounding)
|
|||
{
|
||||
test_double_to_half_rounding(_mesa_double_to_float16_rtz, RTZ);
|
||||
}
|
||||
|
||||
TEST(double_to_float16_ru, rounding)
|
||||
{
|
||||
test_double_to_half_rounding(_mesa_double_to_float16_ru, RU);
|
||||
}
|
||||
|
||||
TEST(double_to_float16_rd, rounding)
|
||||
{
|
||||
test_double_to_half_rounding(_mesa_double_to_float16_rd, RD);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue