Index: src/objects-printer.cc |
diff --git a/src/objects-printer.cc b/src/objects-printer.cc |
index 3a5bb806a21894b60e3c0d7a01ceff2505af2223..799561eb8b38b1d26756302fc2b95f560685cced 100644 |
--- a/src/objects-printer.cc |
+++ b/src/objects-printer.cc |
@@ -210,62 +210,34 @@ void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT |
} |
-void Int32x4::Int32x4Print(std::ostream& os) { // NOLINT |
- char arr[100]; |
- Vector<char> buffer(arr, arraysize(arr)); |
- os << std::string(IntToCString(get_lane(0), buffer)) << ", " |
- << std::string(IntToCString(get_lane(1), buffer)) << ", " |
- << std::string(IntToCString(get_lane(2), buffer)) << ", " |
- << std::string(IntToCString(get_lane(3), buffer)); |
-} |
- |
- |
-void Bool32x4::Bool32x4Print(std::ostream& os) { // NOLINT |
- os << std::string(get_lane(0) ? "true" : "false") << ", " |
- << std::string(get_lane(1) ? "true" : "false") << ", " |
- << std::string(get_lane(2) ? "true" : "false") << ", " |
- << std::string(get_lane(3) ? "true" : "false"); |
-} |
- |
- |
-void Int16x8::Int16x8Print(std::ostream& os) { // NOLINT |
- char arr[100]; |
- Vector<char> buffer(arr, arraysize(arr)); |
- os << std::string(IntToCString(get_lane(0), buffer)); |
- for (int i = 1; i < 8; i++) { |
- os << ", " << std::string(IntToCString(get_lane(i), buffer)); |
- } |
-} |
- |
- |
-void Bool16x8::Bool16x8Print(std::ostream& os) { // NOLINT |
- char arr[100]; |
- Vector<char> buffer(arr, arraysize(arr)); |
- os << std::string(get_lane(0) ? "true" : "false"); |
- for (int i = 1; i < 8; i++) { |
- os << ", " << std::string(get_lane(i) ? "true" : "false"); |
- } |
-} |
- |
- |
-void Int8x16::Int8x16Print(std::ostream& os) { // NOLINT |
- char arr[100]; |
- Vector<char> buffer(arr, arraysize(arr)); |
- os << std::string(IntToCString(get_lane(0), buffer)); |
- for (int i = 1; i < 16; i++) { |
- os << ", " << std::string(IntToCString(get_lane(i), buffer)); |
+#define SIMD128_INT_PRINT_FUNCTION(type, lane_count) \ |
+ void type::type##Print(std::ostream& os) { \ |
+ char arr[100]; \ |
+ Vector<char> buffer(arr, arraysize(arr)); \ |
+ os << std::string(IntToCString(get_lane(0), buffer)); \ |
+ for (int i = 1; i < lane_count; i++) { \ |
+ os << ", " << std::string(IntToCString(get_lane(i), buffer)); \ |
+ } \ |
} |
-} |
- |
- |
-void Bool8x16::Bool8x16Print(std::ostream& os) { // NOLINT |
- char arr[100]; |
- Vector<char> buffer(arr, arraysize(arr)); |
- os << std::string(get_lane(0) ? "true" : "false"); |
- for (int i = 1; i < 16; i++) { |
- os << ", " << std::string(get_lane(i) ? "true" : "false"); |
+SIMD128_INT_PRINT_FUNCTION(Int32x4, 4) |
+SIMD128_INT_PRINT_FUNCTION(Int16x8, 8) |
+SIMD128_INT_PRINT_FUNCTION(Int8x16, 16) |
+#undef SIMD128_INT_PRINT_FUNCTION |
+ |
+ |
+#define SIMD128_BOOL_PRINT_FUNCTION(type, lane_count) \ |
+ void type::type##Print(std::ostream& os) { \ |
+ char arr[100]; \ |
+ Vector<char> buffer(arr, arraysize(arr)); \ |
+ os << std::string(get_lane(0) ? "true" : "false"); \ |
+ for (int i = 1; i < lane_count; i++) { \ |
+ os << ", " << std::string(get_lane(i) ? "true" : "false"); \ |
+ } \ |
} |
-} |
+SIMD128_BOOL_PRINT_FUNCTION(Bool32x4, 4) |
+SIMD128_BOOL_PRINT_FUNCTION(Bool16x8, 8) |
+SIMD128_BOOL_PRINT_FUNCTION(Bool8x16, 16) |
+#undef SIMD128_BOOL_PRINT_FUNCTION |
void ByteArray::ByteArrayPrint(std::ostream& os) { // NOLINT |