Backed out 2 changesets (bug 903746) for causing non-unified build bustages on nsIPri...
[gecko.git] / third_party / highway / hwy / print-inl.h
blob8c5044417fd7e27a78ca53e8ae8838b77e8a8614
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.
16 // Print() function
18 #include "hwy/aligned_allocator.h"
19 #include "hwy/highway.h"
20 #include "hwy/print.h"
22 // Per-target include guard
23 #if defined(HIGHWAY_HWY_PRINT_INL_H_) == \
24 defined(HWY_TARGET_TOGGLE)
25 #ifdef HIGHWAY_HWY_PRINT_INL_H_
26 #undef HIGHWAY_HWY_PRINT_INL_H_
27 #else
28 #define HIGHWAY_HWY_PRINT_INL_H_
29 #endif
31 HWY_BEFORE_NAMESPACE();
32 namespace hwy {
33 namespace HWY_NAMESPACE {
35 // Prints lanes around `lane`, in memory order.
36 template <class D, class V = VFromD<D>>
37 HWY_API void Print(const D d, const char* caption, V v, size_t lane_u = 0,
38 size_t max_lanes = 7) {
39 const size_t N = Lanes(d);
40 using T = TFromD<D>;
41 auto lanes = AllocateAligned<T>(N);
42 Store(v, d, lanes.get());
44 const auto info = hwy::detail::MakeTypeInfo<T>();
45 hwy::detail::PrintArray(info, caption, lanes.get(), N, lane_u, max_lanes);
48 // NOLINTNEXTLINE(google-readability-namespace-comments)
49 } // namespace HWY_NAMESPACE
50 } // namespace hwy
51 HWY_AFTER_NAMESPACE();
53 #endif // per-target include guard