summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2016-10-26 13:24:18 -0700
committerXiang, Haihao <haihao.xiang@intel.com>2016-10-31 10:00:08 +0800
commitae876c632bf9c8c0dc60db36a0ec0ed8e04daf8a (patch)
treed59de776999c4416383387f77d37e663d258ea86
parentb2bdb10ff62c93f603c358a1be0f4ef5588edf2e (diff)
downloadlibva-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.h25
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>