OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2012 Lawrence Livermore National Laboratory | 3 * Copyright (c) 2012 Lawrence Livermore National Laboratory |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 uint32_t h1 = seed; | 205 uint32_t h1 = seed; |
206 | 206 |
207 uint32_t c1 = 0xcc9e2d51; | 207 uint32_t c1 = 0xcc9e2d51; |
208 uint32_t c2 = 0x1b873593; | 208 uint32_t c2 = 0x1b873593; |
209 | 209 |
210 //---------- | 210 //---------- |
211 // body | 211 // body |
212 | 212 |
213 const uint32_t * blocks = (const uint32_t *)(data + nblocks*4); | 213 const uint32_t * blocks = (const uint32_t *)(data + nblocks*4); |
214 | 214 |
215 for(std::size_t i = -nblocks; i; i++) //PDB: was int i | 215 for(int i = -(int)nblocks; i; i++) |
216 { | 216 { |
217 uint32_t k1 = getblock(blocks,i); | 217 uint32_t k1 = getblock(blocks,i); |
218 | 218 |
219 k1 *= c1; | 219 k1 *= c1; |
220 k1 = rotl32(k1,15); | 220 k1 = rotl32(k1,15); |
221 k1 *= c2; | 221 k1 *= c2; |
222 ···· | 222 ···· |
223 h1 ^= k1; | 223 h1 ^= k1; |
224 h1 = rotl32(h1,13);· | 224 h1 = rotl32(h1,13);· |
225 h1 = h1*5+0xe6546b64; | 225 h1 = h1*5+0xe6546b64; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 uint32_t c1 = 0x239b961b;· | 315 uint32_t c1 = 0x239b961b;· |
316 uint32_t c2 = 0xab0e9789; | 316 uint32_t c2 = 0xab0e9789; |
317 uint32_t c3 = 0x38b34ae5;· | 317 uint32_t c3 = 0x38b34ae5;· |
318 uint32_t c4 = 0xa1e38b93; | 318 uint32_t c4 = 0xa1e38b93; |
319 | 319 |
320 //---------- | 320 //---------- |
321 // body | 321 // body |
322 | 322 |
323 const uint32_t * blocks = (const uint32_t *)(data + nblocks*16); | 323 const uint32_t * blocks = (const uint32_t *)(data + nblocks*16); |
324 | 324 |
325 for(std::size_t i = -nblocks; i; i++) //PDB: was int i | 325 for(int i = -(int)nblocks; i; i++) |
326 { | 326 { |
327 uint32_t k1 = getblock(blocks,i*4+0); | 327 uint32_t k1 = getblock(blocks,i*4+0); |
328 uint32_t k2 = getblock(blocks,i*4+1); | 328 uint32_t k2 = getblock(blocks,i*4+1); |
329 uint32_t k3 = getblock(blocks,i*4+2); | 329 uint32_t k3 = getblock(blocks,i*4+2); |
330 uint32_t k4 = getblock(blocks,i*4+3); | 330 uint32_t k4 = getblock(blocks,i*4+3); |
331 | 331 |
332 k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1; | 332 k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1; |
333 | 333 |
334 h1 = rotl32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b; | 334 h1 = rotl32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b; |
335 | 335 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 clear (); | 519 clear (); |
520 } | 520 } |
521 | 521 |
522 uint32_t | 522 uint32_t |
523 Murmur3::GetHash32 (const char * buffer, const std::size_t size) | 523 Murmur3::GetHash32 (const char * buffer, const std::size_t size) |
524 { | 524 { |
525 using namespace Murmur3Implementation; | 525 using namespace Murmur3Implementation; |
526 | 526 |
527 MurmurHash3_x86_32_incr (buffer, size, | 527 MurmurHash3_x86_32_incr (buffer, size, |
528 m_hash32, (void *)& m_hash32); | 528 m_hash32, (void *)& m_hash32); |
529 m_size32 += static_cast<uint32_t> (size); | 529 m_size32 += size; |
530 uint32_t hash; | 530 uint32_t hash; |
531 MurmurHash3_x86_32_fin (m_size32, m_hash32, (void *) & hash); | 531 MurmurHash3_x86_32_fin (m_size32, m_hash32, (void *) & hash); |
532 | 532 |
533 return hash; | 533 return hash; |
534 } | 534 } |
535 | 535 |
536 uint64_t | 536 uint64_t |
537 Murmur3::GetHash64 (const char * buffer, const std::size_t size) | 537 Murmur3::GetHash64 (const char * buffer, const std::size_t size) |
538 { | 538 { |
539 using namespace Murmur3Implementation; | 539 using namespace Murmur3Implementation; |
(...skipping 30 matching lines...) Expand all Loading... |
570 m_size32 = 0; | 570 m_size32 = 0; |
571 m_hash64[0] = m_hash64[1] = ((uint64_t)SEED << 32) | (uint32_t)SEED; | 571 m_hash64[0] = m_hash64[1] = ((uint64_t)SEED << 32) | (uint32_t)SEED; |
572 m_size64 = 0; | 572 m_size64 = 0; |
573 } | 573 } |
574 | 574 |
575 } // namespace Function | 575 } // namespace Function |
576 | 576 |
577 } // namespace Hash | 577 } // namespace Hash |
578 | 578 |
579 } // namespace ns3 | 579 } // namespace ns3 |
OLD | NEW |