mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ue2string: bring caseless cmp inline
This commit is contained in:
parent
54c0fb7e0e
commit
da89f5ef6b
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Intel Corporation
|
* Copyright (c) 2015-2016, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -173,7 +173,16 @@ size_t maxStringSelfOverlap(const string &a, bool nocase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 cmp(const char *a, const char *b, size_t len, bool nocase) {
|
u32 cmp(const char *a, const char *b, size_t len, bool nocase) {
|
||||||
return cmpForward((const u8 *)a, (const u8 *)b, len, nocase);
|
if (!nocase) {
|
||||||
|
return memcmp(a, b, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto *a_end = a + len; a < a_end; a++, b++) {
|
||||||
|
if (mytoupper(*a) != mytoupper(*b)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case_iter::case_iter(const ue2_literal &ss) : s(ss.get_string()),
|
case_iter::case_iter(const ue2_literal &ss) : s(ss.get_string()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user