MAX_MCS_INDEX is a valid array index.
[metze/wireshark/wip.git] / epan / asm_utils.c
1 /* asm_utils.c
2  * Functions optionally implemented in assembler
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #include "config.h"
24
25 #include <string.h>
26 #include <glib.h>
27
28 #include "asm_utils.h"
29
30 /* String comparison func for dfilter_token GTree */
31 gint
32 wrs_strcmp(gconstpointer a, gconstpointer b)
33 {
34     return strcmp((const char*)a, (const char*)b);
35 }
36
37 gint
38 wrs_strcmp_with_data(gconstpointer a, gconstpointer b, gpointer user_data _U_)
39 {
40     return strcmp((const char*)a, (const char*)b);
41 }
42
43 gboolean
44 wrs_str_equal(gconstpointer a, gconstpointer b)
45 {
46     return !strcmp((const char*)a, (const char*)b);
47 }
48
49 guchar
50 wrs_check_charset(const guint8 table[256], const char *str)
51 {
52     const char *p = str;
53     guchar c;
54
55     do {
56       c = *(p++);
57     } while (table[c]);
58     return c;
59 }
60
61 guint
62 wrs_str_hash(gconstpointer v)
63 {
64     /* 31 bit hash function */
65     const signed char *p = (const signed char *)v;
66     guint32 h = *p;
67     if (h)
68         for (p += 1; *p != '\0'; p++)
69             h = (h << 5) - h + *p;
70     return h;
71 }
72
73 /*
74  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
75  *
76  * Local variables:
77  * c-basic-offset: 4
78  * tab-width: 8
79  * indent-tabs-mode: nil
80  * End:
81  *
82  * vi: set shiftwidth=4 tabstop=8 expandtab:
83  * :indentSize=4:tabSize=8:noTabs=true:
84  */