[flang-commits] [flang] [llvm] [flang] Implement SPLIT intrinsic subroutine with tests (PR #185584)
via flang-commits
flang-commits at lists.llvm.org
Sat Mar 14 01:15:59 PDT 2026
================
@@ -992,6 +992,56 @@ static RT_API_ATTRS void TokenizePositionsImpl(Descriptor &first,
}
}
+// SPLIT - scans for the next separator character in STRING.
+// When BACK is false (or absent), returns the position of the leftmost
+// character in SET whose position in STRING is greater than POS, or
+// LEN(STRING)+1 if no such character exists.
+// When BACK is true, returns the position of the rightmost character in
+// SET whose position in STRING is less than POS, or 0 if no such
+// character exists.
+template <typename CHAR>
+static RT_API_ATTRS std::size_t SplitImpl(const CHAR *string,
+ std::size_t stringLen, const CHAR *set, std::size_t setLen, std::size_t pos,
+ bool back) {
+ if (back) {
----------------
laoshd wrote:
Re-Implemented in terms of SCAN.
https://github.com/llvm/llvm-project/pull/185584
More information about the flang-commits
mailing list