diff options
author | Marek Olšák <[email protected]> | 2020-01-24 22:17:09 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-11 00:34:57 +0000 |
commit | cd7241c4f8082dbd07f0bcd268741c527512c66b (patch) | |
tree | 5676c035ad4a5282386aa405ea10b3cbd4281735 /src/mesa/main/macros.h | |
parent | afa7f1984a4f1779c42e2dfa5535635d364e92a7 (diff) |
vbo: pass only either uint32_t or uint64_t into ATTR_UNION
This makes the next commit possible.
Reviewed-by: Mathias Fröhlich <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3766>
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r-- | src/mesa/main/macros.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 03a228b4474..8b09e7b20e9 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -194,6 +194,20 @@ static inline fi_type FLOAT_AS_UNION(GLfloat f) return tmp; } +static inline uint64_t DOUBLE_AS_UINT64(double d) +{ + union { + double d; + uint64_t u64; + } tmp; + tmp.d = d; + return tmp.u64; +} + +/* First sign-extend x, then return uint32_t. */ +#define INT_AS_UINT(x) ((uint32_t)((int32_t)(x))) +#define FLOAT_AS_UINT(x) (FLOAT_AS_UNION(x).u) + /** * Convert a floating point value to an unsigned fixed point value. * |