3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (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, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "ws_symbol_export.h"
29 #include "ws_mempbrk.h"
32 _ws_mempbrk(const guint8* haystack, size_t haystacklen, const guint8 *needles)
34 gchar tmp[256] = { 0 };
35 const guint8 *haystack_end;
40 haystack_end = haystack + haystacklen;
41 while (haystack < haystack_end) {
50 WS_DLL_PUBLIC const guint8 *
51 ws_mempbrk(const guint8* haystack, size_t haystacklen, const guint8 *needles)
54 static int have_sse42 = -1;
60 if G_UNLIKELY(have_sse42 < 0)
61 have_sse42 = ws_cpuid_sse42();
63 if (haystacklen >= 16 && have_sse42)
64 return _ws_mempbrk_sse42(haystack, haystacklen, needles);
67 return _ws_mempbrk(haystack, haystacklen, needles);