Blender V5.3
util_half_test.h File Reference
#include <gtest/gtest.h>
#include "util/half.h"
#include "util/simd.h"
#include "util/system.h"
#include <array>

Go to the source code of this file.

Classes

struct  HalfTestVal

Macros

#define EXPECT_HALF_EQ(a, b)

Functions

static CCL_NAMESPACE_BEGIN bool validate_cpu_capabilities ()
 TEST (TEST_CATEGORY_NAME, float_to_half)
 TEST (TEST_CATEGORY_NAME, float3_to_packed_half3)
 TEST (TEST_CATEGORY_NAME, float4_to_half4)
 TEST (TEST_CATEGORY_NAME, fallback_float_to_half)
 TEST (TEST_CATEGORY_NAME, half_to_float_flush_to_zero)
 TEST (TEST_CATEGORY_NAME, fallback_float3_to_packed_half3)
 TEST (TEST_CATEGORY_NAME, fallback_float4_to_half4)

Variables

static const std::array< HalfTestVal, 13 > test_values

Macro Definition Documentation

◆ EXPECT_HALF_EQ

#define EXPECT_HALF_EQ ( a,
b )
Value:
do { \
const uint16_t a_ = (a); \
const uint16_t b_ = (b); \
if ((a_ & 0x7fff) == 0 && (b_ & 0x7fff) == 0) { \
\
} \
else { \
EXPECT_EQ(a_, b_); \
} \
} while (0)

Definition at line 23 of file util_half_test.h.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

Function Documentation

◆ TEST() [1/7]

◆ TEST() [2/7]

◆ TEST() [3/7]

◆ TEST() [4/7]

◆ TEST() [5/7]

◆ TEST() [6/7]

◆ TEST() [7/7]

◆ validate_cpu_capabilities()

CCL_NAMESPACE_BEGIN bool validate_cpu_capabilities ( )
static

Definition at line 14 of file util_half_test.h.

References system_cpu_support_avx2(), and validate_cpu_capabilities().

Variable Documentation

◆ test_values

const std::array<HalfTestVal, 13> test_values
static
Initial value:
= {{{0.0f, 0x0000},
{-0.0f, 0x8000},
{1.0f, 0x3c00},
{2.0f, 0x4000},
{10.0f, 0x4900},
{100.0f, 0x5640},
{0.0999755859375f, 0x2e66},
{-0.0999755859375f, 0xae66},
{-0.5f, 0xb800},
{-1.0f, 0xbc00},
{6.103515625e-5f, 0x0400},
{6.0975551605e-5f, 0x03ff},
{5.9604644775e-8f, 0x0001}}}

Definition at line 41 of file util_half_test.h.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().