41#ifndef MUTT_MUTT_EQI_H
42#define MUTT_MUTT_EQI_H
65 const char ch = x >> (bytenum * 8);
66 const uint64_t mask = ((ch >=
'a') && (ch <=
'z')) ? 0x20 : 0;
67 return mask << (bytenum * 8);
76static inline bool eqi1(
const char *a,
const char b[1])
88static inline bool eqi2(
const char *a,
const char b[2])
91 memcpy(&a16, a,
sizeof(a16));
92 memcpy(&b16, b,
sizeof(b16));
95 return (a16 | lowercase_mask) == b16;
104static inline bool eqi4(
const char *a,
const char b[4])
107 memcpy(&a32, a,
sizeof(a32));
108 memcpy(&b32, b,
sizeof(b32));
113 return (a32 | lowercase_mask) == b32;
122static inline bool eqi8(
const char *a,
const char b[8])
125 memcpy(&a64, a,
sizeof(a64));
126 memcpy(&b64, b,
sizeof(b64));
135 return (a64 | lowercase_mask) == b64;
143static inline bool eqi5(
const char *a,
const char b[5])
145 return eqi4(a, b) &&
eqi1(a + 1, b + 1);
149static inline bool eqi6(
const char *a,
const char b[6])
151 return eqi4(a, b) &&
eqi2(a + 4, b + 4);
157static inline bool eqi9(
const char *a,
const char b[9])
159 return eqi8(a, b) &&
eqi1(a + 8, b + 8);
163static inline bool eqi10(
const char *a,
const char b[10])
165 return eqi8(a, b) &&
eqi2(a + 8, b + 8);
169static inline bool eqi11(
const char *a,
const char b[11])
171 return eqi8(a, b) &&
eqi4(a + 7, b + 7);
175static inline bool eqi12(
const char *a,
const char b[12])
177 return eqi8(a, b) &&
eqi4(a + 8, b + 8);
181static inline bool eqi13(
const char *a,
const char b[13])
183 return eqi8(a, b) &&
eqi8(a + 5, b + 5);
187static inline bool eqi14(
const char *a,
const char b[14])
189 return eqi8(a, b) &&
eqi8(a + 6, b + 6);
193static inline bool eqi15(
const char *a,
const char b[15])
195 return eqi8(a, b) &&
eqi8(a + 7, b + 7);
199static inline bool eqi16(
const char *a,
const char b[16])
201 return eqi8(a, b) &&
eqi8(a + 8, b + 8);
205static inline bool eqi17(
const char *a,
const char b[17])
207 return eqi16(a, b) &&
eqi1(a + 16, b + 16);
static bool eqi17(const char *a, const char b[17])
eqi17 - Compare two 17-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi9(const char *a, const char b[9])
eqi9 - Compare two 9-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi10(const char *a, const char b[10])
eqi10 - Compare two 10-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi8(const char *a, const char b[8])
Compare two 8-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons.
static bool eqi11(const char *a, const char b[11])
eqi11 - Compare two 11-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi6(const char *a, const char b[6])
eqi6 - Compare two 6-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi14(const char *a, const char b[14])
eqi14 - Compare two 14-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi13(const char *a, const char b[13])
eqi13 - Compare two 13-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi4(const char *a, const char b[4])
Compare two 4-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons.
static uint64_t make_lowercase_mask(uint64_t x, int bytenum)
Create a mask to lowercase alphabetic characters.
static bool eqi5(const char *a, const char b[5])
eqi5 - Compare two 5-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi12(const char *a, const char b[12])
eqi12 - Compare two 12-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi16(const char *a, const char b[16])
eqi16 - Compare two 16-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi15(const char *a, const char b[15])
eqi15 - Compare two 15-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons
static bool eqi1(const char *a, const char b[1])
Compare two 1-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons.
static bool eqi2(const char *a, const char b[2])
Compare two 2-byte strings, ignoring case - See: Case-insensitive fixed-chunk comparisons.