mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-14 03:03:14 +02:00
Fix segfault with gxx
This commit is contained in:
parent
103c6d89f2
commit
659d7e7335
1 changed files with 4 additions and 9 deletions
|
@ -30,15 +30,10 @@ static const std::array<Key, 4> KEYS {{
|
|||
}};
|
||||
|
||||
void xorHelper(char* start, int size, Key key) {
|
||||
const auto end = start + size;
|
||||
|
||||
auto p = start;
|
||||
for (; p + sizeof(Key) < end; p += sizeof(Key)) {
|
||||
*reinterpret_cast<Key*>(p) ^= key;
|
||||
}
|
||||
|
||||
for (int i = 0; p < end; ++p || ++i) {
|
||||
*p ^= *(reinterpret_cast<const char*>(&key) + i);
|
||||
auto current = start;
|
||||
auto xorValue = reinterpret_cast<const char*>(&key);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
*(current++) ^= *(xorValue + (i % sizeof(Key)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue