[Libva] [PATCH intel-driver 4/5] test: streamable valarray

U. Artie Eoff ullysses.a.eoff at intel.com
Wed Oct 26 20:24:18 UTC 2016


Add stream operators for std::valarray.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 test/i965_streamable.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/i965_streamable.h b/test/i965_streamable.h
index 4969c1413173..0f7e1291c4c4 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>
-- 
2.1.0



More information about the Libva mailing list