Nikolay Sivov : include: Make inline helpers compatible with NONAMELESSUNION.

Alexandre Julliard julliard at winehq.org
Wed Jun 24 15:47:35 CDT 2020


Module: wine
Branch: master
Commit: 6aeb891d529d821fa62e26c177c186c3acb25f23
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6aeb891d529d821fa62e26c177c186c3acb25f23

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Jun 24 16:25:37 2020 +0300

include: Make inline helpers compatible with NONAMELESSUNION.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/dxva2api.idl | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/dxva2api.idl b/include/dxva2api.idl
index eb4a26509a..04e620b7be 100644
--- a/include/dxva2api.idl
+++ b/include/dxva2api.idl
@@ -805,23 +805,24 @@ cpp_quote("#endif")
 
 cpp_quote("static inline DXVA2_Fixed32 DXVA2_Fixed32OpaqueAlpha(void) {")
 cpp_quote("  DXVA2_Fixed32 f32;")
-cpp_quote("  f32.ll = 0 + (1 << 16);")
+cpp_quote("  *(LONG *)&f32 = 0 + (1 << 16);")
 cpp_quote("  return f32;")
 cpp_quote("}")
 cpp_quote("")
 cpp_quote("static inline DXVA2_Fixed32 DXVA2_Fixed32TransparentAlpha(void) {")
-cpp_quote("  DXVA2_Fixed32 f32;")
-cpp_quote("  f32.ll = 0;")
+cpp_quote("  DXVA2_Fixed32 f32 = {{{ 0 }}};")
 cpp_quote("  return f32;")
 cpp_quote("}")
 cpp_quote("")
 cpp_quote("static inline float DXVA2FixedToFloat(DXVA2_Fixed32 f32) {")
-cpp_quote("  return (float)f32.Value + (float)f32.Fraction / (1 << 16);")
+cpp_quote("  struct { USHORT Fraction; SHORT Value; } *_f32 = (void *)&f32;")
+cpp_quote("  return (float)_f32->Value + (float)_f32->Fraction / (1 << 16);")
 cpp_quote("}")
 cpp_quote("")
 cpp_quote("static inline DXVA2_Fixed32 DXVA2FloatToFixed(float f) {")
 cpp_quote("  DXVA2_Fixed32 f32;")
-cpp_quote("  f32.Value    = ((ULONG) (f * (1 << 16))) >> 16;")
-cpp_quote("  f32.Fraction = ((ULONG) (f * (1 << 16))) & 0xFFFF;")
+cpp_quote("  struct { USHORT Fraction; SHORT Value; } *_f32 = (void *)&f32;")
+cpp_quote("  _f32->Value    = ((ULONG) (f * (1 << 16))) >> 16;")
+cpp_quote("  _f32->Fraction = ((ULONG) (f * (1 << 16))) & 0xFFFF;")
 cpp_quote("  return f32;")
 cpp_quote("}")




More information about the wine-cvs mailing list