diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-04 19:22:04 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 01:23:06 +0300 |
| commit | 41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch) | |
| tree | 3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/simd/index_of.cpp | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/simd/index_of.cpp')
| -rw-r--r-- | vendor/libghostty-vt/src/simd/index_of.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/simd/index_of.cpp b/vendor/libghostty-vt/src/simd/index_of.cpp new file mode 100644 index 00000000..b070ae3b --- /dev/null +++ b/vendor/libghostty-vt/src/simd/index_of.cpp @@ -0,0 +1,53 @@ +// Generates code for every target that this compiler can support. +#undef HWY_TARGET_INCLUDE +#define HWY_TARGET_INCLUDE "simd/index_of.cpp" // this file +#include <hwy/foreach_target.h> // must come before highway.h +#include <hwy/highway.h> + +#include <simd/index_of.h> + +#include <optional> + +HWY_BEFORE_NAMESPACE(); +namespace ghostty { +namespace HWY_NAMESPACE { + +namespace hn = hwy::HWY_NAMESPACE; + +size_t IndexOf(const uint8_t needle, + const uint8_t* HWY_RESTRICT input, + size_t count) { + const hn::ScalableTag<uint8_t> d; + return IndexOfImpl(d, needle, input, count); +} + +} // namespace HWY_NAMESPACE +} // namespace ghostty +HWY_AFTER_NAMESPACE(); + +// HWY_ONCE is true for only one of the target passes +#if HWY_ONCE + +namespace ghostty { + +// This macro declares a static array used for dynamic dispatch. +HWY_EXPORT(IndexOf); + +size_t IndexOf(const uint8_t needle, + const uint8_t* HWY_RESTRICT input, + size_t count) { + return HWY_DYNAMIC_DISPATCH(IndexOf)(needle, input, count); +} + +} // namespace ghostty + +extern "C" { + +size_t ghostty_simd_index_of(const uint8_t needle, + const uint8_t* HWY_RESTRICT input, + size_t count) { + return ghostty::IndexOf(needle, input, count); +} +} + +#endif // HWY_ONCE |
