1
/* -*- buffer-read-only: t -*- vi: set ro: */
2
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
/* Optimized string comparison.
4
Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc.
6
This program is free software: you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published
8
by the Free Software Foundation; either version 3 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
/* Written by Bruno Haible <bruno@clisp.org>. */
26
/* STREQ allows to optimize string comparison with a small literal string.
27
STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
28
is semantically equivalent to
29
strcmp (s, "EUC-KR") == 0
32
/* Help GCC to generate good code for string comparisons with
34
#if defined (__GNUC__) && defined (__OPTIMIZE__)
37
streq9 (const char *s1, const char *s2)
39
return strcmp (s1 + 9, s2 + 9) == 0;
43
streq8 (const char *s1, const char *s2, char s28)
50
return streq9 (s1, s2);
57
streq7 (const char *s1, const char *s2, char s27, char s28)
64
return streq8 (s1, s2, s28);
71
streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
78
return streq7 (s1, s2, s27, s28);
85
streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
92
return streq6 (s1, s2, s26, s27, s28);
99
streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
106
return streq5 (s1, s2, s25, s26, s27, s28);
113
streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
120
return streq4 (s1, s2, s24, s25, s26, s27, s28);
127
streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
134
return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
141
streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
148
return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
155
streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
162
return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
168
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
169
streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
173
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
174
(strcmp (s1, s2) == 0)
178
#endif /* _GL_STREQ_H */