[PATCH 30/57][Arm][GAS] Add support for MVE instructions: vqmovnt, vqmovnb, vqmovunt...
[binutils-gdb.git] / gdb / dwarf-index-common.c
blob220d74881a0879f0d6dc1392137175fe5176f148
1 /* Things needed for both reading and writing DWARF indices.
3 Copyright (C) 1994-2019 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "defs.h"
21 #include "dwarf-index-common.h"
23 /* See dwarf-index-common.h. */
25 hashval_t
26 mapped_index_string_hash (int index_version, const void *p)
28 const unsigned char *str = (const unsigned char *) p;
29 hashval_t r = 0;
30 unsigned char c;
32 while ((c = *str++) != 0)
34 if (index_version >= 5)
35 c = tolower (c);
36 r = r * 67 + c - 113;
39 return r;
42 /* See dwarf-index-common.h. */
44 uint32_t
45 dwarf5_djb_hash (const char *str_)
47 const unsigned char *str = (const unsigned char *) str_;
49 /* Note: tolower here ignores UTF-8, which isn't fully compliant.
50 See http://dwarfstd.org/ShowIssue.php?issue=161027.1. */
52 uint32_t hash = 5381;
53 while (int c = *str++)
54 hash = hash * 33 + tolower (c);
55 return hash;