Skip to content

Commit

Permalink
msvc test3
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonwin committed Apr 11, 2024
1 parent e53b482 commit 28d651b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tiktoken.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,14 @@ class tiktoken {

if (allowed_special.count(special) == 1) {
#if ! defined(_WIN32)
return { std::move(special), re2::StringPiece(start, input.begin() - start - special.size()) };
// return { std::move(special), re2::StringPiece(start, input.begin() - start - special.size()) };
return { std::move(special), re2::StringPiece(reinterpret_cast<const char*>(start), input.begin() - start - special.size()) };
#else
return { std::move(special), re2::StringPiece(start.data(), input.begin() - start - special.size()) };
// build but not work correctly
// return { std::move(special), re2::StringPiece(input.data(), input.begin() - start - special.size()) };

// can work on linux, but msvc?
return { std::move(special), re2::StringPiece(reinterpret_cast<const char*>(start), input.begin() - start - special.size()) };
#endif
}
}
Expand Down

0 comments on commit 28d651b

Please sign in to comment.