tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

simd_util.cc (1016B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 #include "lib/jxl/simd_util.h"
      7 
      8 #include <cstddef>
      9 
     10 #undef HWY_TARGET_INCLUDE
     11 #define HWY_TARGET_INCLUDE "lib/jxl/simd_util.cc"
     12 #include <hwy/foreach_target.h>
     13 #include <hwy/highway.h>
     14 
     15 HWY_BEFORE_NAMESPACE();
     16 namespace jxl {
     17 namespace HWY_NAMESPACE {
     18 
     19 size_t MaxVectorSize() {
     20  HWY_FULL(float) df;
     21  return Lanes(df) * sizeof(float);
     22 }
     23 
     24 // NOLINTNEXTLINE(google-readability-namespace-comments)
     25 }  // namespace HWY_NAMESPACE
     26 }  // namespace jxl
     27 HWY_AFTER_NAMESPACE();
     28 
     29 #if HWY_ONCE
     30 namespace jxl {
     31 
     32 HWY_EXPORT(MaxVectorSize);
     33 
     34 size_t MaxVectorSize() {
     35  // Ideally HWY framework should provide us this value.
     36  // Less than ideal is to check all available targets and choose maximal.
     37  // As for now, we just ask current active target, assuming it won't change.
     38  return HWY_DYNAMIC_DISPATCH(MaxVectorSize)();
     39 }
     40 
     41 }  // namespace jxl
     42 #endif