Use SIMD-instructions in half-precision floats with AVX instruction set

This commit is contained in:
2023-09-03 17:56:18 +03:00
parent e8cb1686c3
commit 4ad78fdb80

View File

@@ -6,13 +6,23 @@
#include "Vector2.h"
#include "Vector3.h"
#if PLATFORM_SIMD_AVX
// MSVC generates slower code without AVX
#define USE_SSE_HALF_CONVERSION 1
#else
#define USE_SSE_HALF_CONVERSION 0
#endif
#if USE_SSE_HALF_CONVERSION
#include <intrin.h>
#include <emmintrin.h>
#endif
/// <summary>
/// Half-precision 16 bit floating point number consisting of a sign bit, a 5 bit biased exponent, and a 10 bit mantissa
/// </summary>
typedef uint16 Half;
#define USE_SSE_HALF_CONVERSION 0
/// <summary>
/// Utility for packing/unpacking floating point value from single precision (32 bit) to half precision (16 bit).
/// </summary>