Skip to content

Commit e895f41

Browse files
committed
Code review feedback
1 parent 32dafde commit e895f41

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

Inc/DirectXPackedVector.inl

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,36 +1294,32 @@ inline XMVECTOR XM_CALLCONV XMLoadFloat3SE(const XMFLOAT3SE* pSource) noexcept
12941294

12951295
#elif defined(_XM_ARM_NEON_INTRINSICS_)
12961296

1297-
uint32_t v = pSource->v;
1298-
12991297
// Build scale factor from shared exponent
13001298
union { float f; int32_t i; } fi;
1301-
fi.i = 0x33800000 + (static_cast<int>(v >> 27) << 23);
1299+
fi.i = 0x33800000 + (pSource->e << 23);
13021300

13031301
// Extract 9-bit mantissas into vector lanes
13041302
uint32x4_t mantissas = vdupq_n_u32(0);
1305-
mantissas = vsetq_lane_u32(v & 0x1FFu, mantissas, 0);
1306-
mantissas = vsetq_lane_u32((v >> 9) & 0x1FFu, mantissas, 1);
1307-
mantissas = vsetq_lane_u32((v >> 18) & 0x1FFu, mantissas, 2);
1303+
mantissas = vsetq_lane_u32(pSource->xm, mantissas, 0);
1304+
mantissas = vsetq_lane_u32(pSource->ym, mantissas, 1);
1305+
mantissas = vsetq_lane_u32(pSource->zm, mantissas, 2);
13081306

13091307
// Convert to float, scale, and set w = 1.0f
13101308
float32x4_t result = vmulq_n_f32(vcvtq_f32_u32(mantissas), fi.f);
13111309
return vsetq_lane_f32(1.0f, result, 3);
13121310

13131311
#elif defined(_XM_SSE_INTRINSICS_)
13141312

1315-
uint32_t v = pSource->v;
1316-
13171313
// Build scale factor from shared exponent
13181314
union { float f; int32_t i; } fi;
1319-
fi.i = 0x33800000 + (static_cast<int>(v >> 27) << 23);
1315+
fi.i = 0x33800000 + (pSource->e << 23);
13201316

13211317
// Extract 9-bit mantissas, convert to float, and scale
13221318
__m128i mantissas = _mm_set_epi32(
13231319
0,
1324-
static_cast<int>((v >> 18) & 0x1FF),
1325-
static_cast<int>((v >> 9) & 0x1FF),
1326-
static_cast<int>(v & 0x1FF));
1320+
static_cast<int>(pSource->zm),
1321+
static_cast<int>(pSource->ym),
1322+
static_cast<int>(pSource->xm));
13271323
__m128 result = _mm_mul_ps(_mm_cvtepi32_ps(mantissas), _mm_set1_ps(fi.f));
13281324

13291325
// Set w = 1.0f (w lane is +0.0f so bitwise OR inserts 1.0f cleanly)

0 commit comments

Comments
 (0)