1

Herein a nice method for comparing two arrays of character is suggested (the accepted answer).

The output of vsand vt can be printed to the screen with this but results of comparisons v are weird (four zeros and random numbers).

Community
  • 1
  • 1
user1436187
  • 3,252
  • 3
  • 26
  • 59
  • 1
    Note that if you happen to be using OS X then the Apple builds of gcc and clang have extensions to printf for printing SIMD vectors, which makes life a lot easier. Unfortunately I don't think these extensions have made it onto other platforms (yet ?). – Paul R Dec 10 '15 at 08:08

1 Answers1

1

If you want print the content of __m128i vector to screen you might use something like this:

template<class T> inline void Log(const T * data, size_t size, const std::string & name)
{
    std::cout << name << " = { ";
    for (int i = 0; i < size; i++)
    {
        std::cout << int(data[i]) << " ";
    }
    std::cout << "} " << std::endl;
}

inline void LogU8(const __m128i & value, const std::string & name)
{
    uint8_t buffer[16];
    _mm_storeu_si128((__m128i*)buffer, value);
    Log(buffer, 16, name);
}
ErmIg
  • 3,980
  • 1
  • 27
  • 40