gallium/util: make bitcast-helpers explicitly sized

These always work on 32-bit variables, so let's make that assumption
explicit.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8034>
This commit is contained in:
Erik Faye-Lund
2020-12-10 13:18:36 +01:00
committed by Marge Bot
parent 0ba788d73b
commit 615c4610bb
+3 -2
View File
@@ -29,6 +29,7 @@
#define U_BITCAST_H_
#include <string.h>
#include <stdint.h>
#include "c99_compat.h"
@@ -36,7 +37,7 @@
extern "C" {
#endif
static inline unsigned
static inline uint32_t
u_bitcast_f2u(float f)
{
unsigned u;
@@ -45,7 +46,7 @@ u_bitcast_f2u(float f)
}
static inline float
u_bitcast_u2f(unsigned u)
u_bitcast_u2f(uint32_t u)
{
float f;
memcpy(&f, &u, sizeof(f));