Skip to content

Commit

Permalink
Merge pull request bulletphysics#3291 from vabr-g/efficient-find
Browse files Browse the repository at this point in the history
Optimize calls to find*() for a single char.
  • Loading branch information
erwincoumans authored Mar 2, 2021
2 parents e913a75 + 364e98c commit 7b84fab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/ThirdPartyLibs/cpp_base64/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ std::string base64_decode(std::string const& encoded_string, bool remove_linebre
std::string copy(encoded_string);

size_t pos=0;
while ((pos = copy.find("\n", pos)) != std::string::npos) {
while ((pos = copy.find('\n', pos)) != std::string::npos) {
copy.erase(pos, 1);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/TinyRenderer/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Vec3f Model::vert(int iface, int nthvert)
void Model::load_texture(std::string filename, const char *suffix, TGAImage &img)
{
std::string texfile(filename);
size_t dot = texfile.find_last_of(".");
size_t dot = texfile.find_last_of('.');
if (dot != std::string::npos)
{
texfile = texfile.substr(0, dot) + std::string(suffix);
Expand Down

0 comments on commit 7b84fab

Please sign in to comment.