mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 15:57:31 +09:00
parent
38d4836a94
commit
639d4eb85f
31 changed files with 107 additions and 867 deletions
|
|
@ -20,17 +20,7 @@ HashBytes(const void* aBytes, size_t aLength)
|
|||
|
||||
/* Walk word by word. */
|
||||
size_t i = 0;
|
||||
const size_t wordLength = aLength - (aLength % sizeof(size_t));
|
||||
const size_t doubleWordLength = wordLength - (wordLength % (2 * sizeof(size_t)));
|
||||
for (; i < doubleWordLength; i += 2 * sizeof(size_t)) {
|
||||
size_t data0;
|
||||
size_t data1;
|
||||
memcpy(&data0, b + i, sizeof(data0));
|
||||
memcpy(&data1, b + i + sizeof(data0), sizeof(data1));
|
||||
hash = AddToHash(hash, data0, sizeof(data0));
|
||||
hash = AddToHash(hash, data1, sizeof(data1));
|
||||
}
|
||||
for (; i < wordLength; i += sizeof(size_t)) {
|
||||
for (; i < aLength - (aLength % sizeof(size_t)); i += sizeof(size_t)) {
|
||||
/* Do an explicitly unaligned load of the data. */
|
||||
size_t data;
|
||||
memcpy(&data, b + i, sizeof(size_t));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue