2019-07-08 20:50:41 +02:00
|
|
|
// OpenSTA, Static Timing Analyzer
|
2023-02-19 01:55:40 +01:00
|
|
|
// Copyright (c) 2023, Parallax Software, Inc.
|
2019-07-08 20:50:41 +02:00
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2022-01-04 18:17:08 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-07-08 20:50:41 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2022-01-04 18:17:08 +01:00
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-07-08 20:50:41 +02:00
|
|
|
|
2020-04-05 23:53:44 +02:00
|
|
|
#include "Hash.hh"
|
2020-04-05 20:35:51 +02:00
|
|
|
|
2019-07-08 20:50:41 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
namespace sta {
|
|
|
|
|
|
2019-08-08 23:13:02 +02:00
|
|
|
size_t
|
2019-07-08 20:50:41 +02:00
|
|
|
hashString(const char *str)
|
|
|
|
|
{
|
2019-08-08 23:13:02 +02:00
|
|
|
size_t hash = hash_init_value;
|
2019-07-08 20:50:41 +02:00
|
|
|
size_t length = strlen(str);
|
|
|
|
|
for (size_t i = 0; i < length; i++)
|
|
|
|
|
hash = ((hash << 5) + hash) ^ str[i];
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|