comparison libstdc++-v3/libsupc++/hash_bytes.cc @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // Definition of _Hash_bytes. -*- C++ -*- 1 // Definition of _Hash_bytes. -*- C++ -*-
2 2
3 // Copyright (C) 2010-2018 Free Software Foundation, Inc. 3 // Copyright (C) 2010-2020 Free Software Foundation, Inc.
4 // 4 //
5 // This file is part of the GNU ISO C++ Library. This library is free 5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the 6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the 7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option) 8 // Free Software Foundation; either version 3, or (at your option)
137 + (size_t) 0x5bd1e995UL; 137 + (size_t) 0x5bd1e995UL;
138 const char* const buf = static_cast<const char*>(ptr); 138 const char* const buf = static_cast<const char*>(ptr);
139 139
140 // Remove the bytes not divisible by the sizeof(size_t). This 140 // Remove the bytes not divisible by the sizeof(size_t). This
141 // allows the main loop to process the data as 64-bit integers. 141 // allows the main loop to process the data as 64-bit integers.
142 const int len_aligned = len & ~0x7; 142 const size_t len_aligned = len & ~(size_t)0x7;
143 const char* const end = buf + len_aligned; 143 const char* const end = buf + len_aligned;
144 size_t hash = seed ^ (len * mul); 144 size_t hash = seed ^ (len * mul);
145 for (const char* p = buf; p != end; p += 8) 145 for (const char* p = buf; p != end; p += 8)
146 { 146 {
147 const size_t data = shift_mix(unaligned_load(p) * mul) * mul; 147 const size_t data = shift_mix(unaligned_load(p) * mul) * mul;