Skip to content

Commit

Permalink
Improve readability of conditional code
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Mar 26, 2019
1 parent 36a1a30 commit b6bfb20
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/arch/intsimdmatrixavx2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,13 @@ static inline void ExtractResults(__m256i& result, __m256i& shift_id,
const int8_t*& wi, const double*& scales,
int num_out, double*& v) {
for (int out = 0; out < num_out; ++out) {
auto res =
#ifndef _MSC_VER
_mm256_extract_epi32(result, 0)
auto res = _mm256_extract_epi32(result, 0);
#else
// Workaround MSVC's ICE
// _mm256_extract_epi32(X, Y) == ((int32_t*)&X)[Y]
((int32_t*)&result)[0]
// Workaround MSVC's ICE
// _mm256_extract_epi32(X, Y) == ((int32_t*)&X)[Y]
auto res = ((int32_t*)&result)[0];
#endif
;
*v++ = (static_cast<double>(res) / INT8_MAX + *wi++) * *scales++;
// Rotate the results in int32_t units, so the next result is ready.
result = _mm256_permutevar8x32_epi32(result, shift_id);
Expand Down

0 comments on commit b6bfb20

Please sign in to comment.