summaryrefslogtreecommitdiff
path: root/src/common/hash.cpp
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2014-11-19 08:49:13 +0000
committerGravatar Emmanuel Gil Peyrot2014-11-19 09:03:07 +0000
commitf5d38649c7ad6fedf9db95044e3ad91ce393b8df (patch)
tree57cd232d34d8f889315331a84f0812e705d2ea88 /src/common/hash.cpp
parentMerge pull request #212 from archshift/idea (diff)
downloadyuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.gz
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.tar.xz
yuzu-f5d38649c7ad6fedf9db95044e3ad91ce393b8df.zip
Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated
Diffstat (limited to '')
-rw-r--r--src/common/hash.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/common/hash.cpp b/src/common/hash.cpp
index d2ebc7341..2ddcfe6b7 100644
--- a/src/common/hash.cpp
+++ b/src/common/hash.cpp
@@ -115,15 +115,15 @@ inline u64 getblock(const u64 * p, int i)
115 115
116inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2) 116inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2)
117{ 117{
118 k1 *= c1; 118 k1 *= c1;
119 k1 = _rotl64(k1,23); 119 k1 = _rotl64(k1,23);
120 k1 *= c2; 120 k1 *= c2;
121 h1 ^= k1; 121 h1 ^= k1;
122 h1 += h2; 122 h1 += h2;
123 123
124 h2 = _rotl64(h2,41); 124 h2 = _rotl64(h2,41);
125 125
126 k2 *= c2; 126 k2 *= c2;
127 k2 = _rotl64(k2,23); 127 k2 = _rotl64(k2,23);
128 k2 *= c1; 128 k2 *= c1;
129 h2 ^= k2; 129 h2 ^= k2;
@@ -250,7 +250,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
250} 250}
251 251
252 252
253/* 253/*
254 * NOTE: This hash function is used for custom texture loading/dumping, so 254 * NOTE: This hash function is used for custom texture loading/dumping, so
255 * it should not be changed, which would require all custom textures to be 255 * it should not be changed, which would require all custom textures to be
256 * recalculated for their new hash values. If the hashing function is 256 * recalculated for their new hash values. If the hashing function is
@@ -273,7 +273,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
273 u64 k = data[0]; 273 u64 k = data[0];
274 data+=Step; 274 data+=Step;
275 k *= m; 275 k *= m;
276 k ^= k >> r; 276 k ^= k >> r;
277 k *= m; 277 k *= m;
278 h ^= k; 278 h ^= k;
279 h *= m; 279 h *= m;
@@ -292,13 +292,13 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
292 case 1: h ^= u64(data2[0]); 292 case 1: h ^= u64(data2[0]);
293 h *= m; 293 h *= m;
294 }; 294 };
295 295
296 h ^= h >> r; 296 h ^= h >> r;
297 h *= m; 297 h *= m;
298 h ^= h >> r; 298 h ^= h >> r;
299 299
300 return h; 300 return h;
301} 301}
302#else 302#else
303// CRC32 hash using the SSE4.2 instruction 303// CRC32 hash using the SSE4.2 instruction
304u64 GetCRC32(const u8 *src, int len, u32 samples) 304u64 GetCRC32(const u8 *src, int len, u32 samples)
@@ -351,15 +351,15 @@ inline u32 fmix32(u32 h)
351 351
352inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2) 352inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2)
353{ 353{
354 k1 *= c1; 354 k1 *= c1;
355 k1 = _rotl(k1,11); 355 k1 = _rotl(k1,11);
356 k1 *= c2; 356 k1 *= c2;
357 h1 ^= k1; 357 h1 ^= k1;
358 h1 += h2; 358 h1 += h2;
359 359
360 h2 = _rotl(h2,17); 360 h2 = _rotl(h2,17);
361 361
362 k2 *= c2; 362 k2 *= c2;
363 k2 = _rotl(k2,11); 363 k2 = _rotl(k2,11);
364 k2 *= c1; 364 k2 *= c1;
365 h2 ^= k2; 365 h2 ^= k2;
@@ -405,7 +405,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
405 405
406 //---------- 406 //----------
407 // tail 407 // tail
408 408
409 const u8 * tail = (const u8*)(data + nblocks*8); 409 const u8 * tail = (const u8*)(data + nblocks*8);
410 410
411 u32 k1 = 0; 411 u32 k1 = 0;
@@ -439,7 +439,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
439 439
440 out[0] = h1; 440 out[0] = h1;
441 out[1] = h2; 441 out[1] = h2;
442 442
443 return *((u64 *)&out); 443 return *((u64 *)&out);
444} 444}
445 445
@@ -463,11 +463,11 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
463 { 463 {
464 u64 k = data[0]; 464 u64 k = data[0];
465 data+=Step; 465 data+=Step;
466 k *= m; 466 k *= m;
467 k ^= k >> r; 467 k ^= k >> r;
468 k *= m; 468 k *= m;
469 h ^= k; 469 h ^= k;
470 h *= m; 470 h *= m;
471 } 471 }
472 472
473 const u8 * data2 = (const u8*)end; 473 const u8 * data2 = (const u8*)end;
@@ -483,7 +483,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
483 case 1: h ^= u64(data2[0]); 483 case 1: h ^= u64(data2[0]);
484 h *= m; 484 h *= m;
485 }; 485 };
486 486
487 h ^= h >> r; 487 h ^= h >> r;
488 h *= m; 488 h *= m;
489 h ^= h >> r; 489 h ^= h >> r;