diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2016-10-26 13:24:18 -0700 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2016-10-31 10:00:08 +0800 |
commit | ae876c632bf9c8c0dc60db36a0ec0ed8e04daf8a (patch) | |
tree | d59de776999c4416383387f77d37e663d258ea86 | |
parent | b2bdb10ff62c93f603c358a1be0f4ef5588edf2e (diff) | |
download | libva-intel-driver-ae876c632bf9c8c0dc60db36a0ec0ed8e04daf8a.tar.gz |
test: streamable valarray
Add stream operators for std::valarray.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
(cherry picked from commit 2bbdc90be2f41198619c073ce1409dc5c64334dc)
-rw-r--r-- | test/i965_streamable.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/i965_streamable.h b/test/i965_streamable.h index 4969c141..0f7e1291 100644 --- a/test/i965_streamable.h +++ b/test/i965_streamable.h @@ -29,6 +29,7 @@ #include <iostream> #include <iomanip> #include <sstream> +#include <valarray> #include <va/va.h> namespace std { @@ -55,6 +56,30 @@ namespace std { } return os << std::dec << "}"; } + + template <typename T> inline std::ostream& + operator<<(std::ostream& os, const std::valarray<T>& a) + { + os << "{"; + for (const auto& s : a) { + if (&s != &a[0]) + os << ","; + os << s; + } + return os << "}"; + } + + template <> inline std::ostream& + operator<<(std::ostream& os, const std::valarray<uint8_t>& a) + { + os << "{" << std::hex; + for (const auto& s : a) { + if (&s != &a[0]) + os << ","; + os << "0x" << std::setfill('0') << std::setw(2) << unsigned(s); + } + return os << std::dec << "}"; + } }// namespace std template <typename T> |