Grok  9.7.5
print.h
Go to the documentation of this file.
1 // Copyright 2022 Google LLC
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef HWY_PRINT_H_
17 #define HWY_PRINT_H_
18 
19 // Helpers for printing vector lanes.
20 
21 #include <stddef.h>
22 
23 #include "hwy/base.h"
24 #include "hwy/highway_export.h"
25 
26 namespace hwy {
27 
28 namespace detail {
29 
30 // For implementing value comparisons etc. as type-erased functions to reduce
31 // template bloat.
32 struct TypeInfo {
33  size_t sizeof_t;
34  bool is_float;
35  bool is_signed;
36 };
37 
38 template <typename T>
40  TypeInfo info;
41  info.sizeof_t = sizeof(T);
42  info.is_float = IsFloat<T>();
43  info.is_signed = IsSigned<T>();
44  return info;
45 }
46 
47 HWY_DLLEXPORT void TypeName(const TypeInfo& info, size_t N, char* string100);
48 HWY_DLLEXPORT void ToString(const TypeInfo& info, const void* ptr,
49  char* string100);
50 
51 HWY_DLLEXPORT void PrintArray(const TypeInfo& info, const char* caption,
52  const void* array_void, size_t N,
53  size_t lane_u = 0, size_t max_lanes = 7);
54 
55 } // namespace detail
56 } // namespace hwy
57 
58 #endif // HWY_PRINT_H_
#define HWY_INLINE
Definition: base.h:64
#define HWY_DLLEXPORT
Definition: highway_export.h:18
N
Definition: rvv-inl.h:1656
HWY_DLLEXPORT void TypeName(const TypeInfo &info, size_t N, char *string100)
HWY_DLLEXPORT void PrintArray(const TypeInfo &info, const char *caption, const void *array_void, size_t N, size_t lane_u=0, size_t max_lanes=7)
HWY_DLLEXPORT void ToString(const TypeInfo &info, const void *ptr, char *string100)
HWY_INLINE TypeInfo MakeTypeInfo()
Definition: print.h:39
Definition: aligned_allocator.h:27
Definition: print.h:32
bool is_float
Definition: print.h:34
bool is_signed
Definition: print.h:35
size_t sizeof_t
Definition: print.h:33