util: Add namespace over float16_t in half_float.h

As float16_t may comes from arm_neon.h:
arm_neon.h:74:16: error: conflicting declaration 'typedef __fp16 float16_t'
   74 | typedef __fp16 float16_t;

Also it is std::float16_t from <stdfloat> as part of C++23

So place it under namespace mesa to avoid conflict when upgrading xxhash.h to v0.8.3

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36654>
This commit is contained in:
Yonggang Luo 2025-08-08 19:53:33 +08:00 committed by Marge Bot
parent 37ee226869
commit 2a6ac3a79c
2 changed files with 7 additions and 0 deletions

View file

@ -51,6 +51,8 @@ struct gl_builtin_uniform_desc;
#ifdef __cplusplus
using float16_t = mesa::float16_t;
/**
* \defgroup IR Intermediate representation nodes
*

View file

@ -126,6 +126,9 @@ _mesa_half_is_negative(uint16_t h)
#ifdef __cplusplus
namespace mesa
{
/* Helper class for disambiguating fp16 from uint16_t in C++ overloads */
struct float16_t {
@ -137,6 +140,8 @@ struct float16_t {
static float16_t zero() { return float16_t(FP16_ZERO); }
};
} /* namespace mesa */
#endif