mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 15:15:37 +00:00
Reverted a removed optimization.
This commit is contained in:
parent
b6f15cb8d9
commit
5208150749
|
@ -16,7 +16,6 @@
|
|||
#include "utils/StringUtil.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <pugixml.hpp>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -172,5 +171,19 @@ const bool MameNames::isDevice(const std::string& _deviceName)
|
|||
|
||||
const bool MameNames::find(std::vector<std::string> devices, const std::string& name)
|
||||
{
|
||||
return (std::find(devices.begin(), devices.end(), name) != devices.end());
|
||||
size_t start = 0;
|
||||
size_t end = devices.size();
|
||||
|
||||
while (start < end) {
|
||||
const size_t index = (start + end) / 2;
|
||||
const int compare = strcmp(devices[index].c_str(), name.c_str());
|
||||
|
||||
if (compare < 0)
|
||||
start = index + 1;
|
||||
else if (compare > 0)
|
||||
end = index;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue