Skip to content

Commit 4c6f2e5

Browse files
author
fengluo
committed
string_fastsearch.h:
format functions
1 parent 09e5cb9 commit 4c6f2e5

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

numpy/_core/src/umath/string_fastsearch.h

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,19 @@
5050
/**
5151
* @brief Defines the bloom filter width based on the size of LONG_BIT.
5252
*
53-
* This macro sets the value of STRINGLIB_BLOOM_WIDTH depending on the
53+
* This macro sets the value of `STRINGLIB_BLOOM_WIDTH` depending on the
5454
* size of the system's LONG_BIT. It ensures that the bloom filter
5555
* width is at least 32 bits.
5656
*
5757
* @error If LONG_BIT is smaller than 32, a compilation error will occur.
5858
*/
5959
#if LONG_BIT >= 128
60-
/**
61-
* @brief Bloom filter width is set to 128 bits.
62-
*/
6360
#define STRINGLIB_BLOOM_WIDTH 128
6461
#elif LONG_BIT >= 64
65-
/**
66-
* @brief Bloom filter width is set to 64 bits.
67-
*/
6862
#define STRINGLIB_BLOOM_WIDTH 64
6963
#elif LONG_BIT >= 32
70-
/**
71-
* @brief Bloom filter width is set to 32 bits.
72-
*/
7364
#define STRINGLIB_BLOOM_WIDTH 32
7465
#else
75-
/**
76-
* @brief Compilation error for unsupported LONG_BIT sizes.
77-
*/
7866
#error "LONG_BIT is smaller than 32"
7967
#endif
8068

@@ -153,7 +141,8 @@ struct CheckedIndexer {
153141
*
154142
* @return The first character in the buffer.
155143
*/
156-
char_type operator*()
144+
char_type
145+
operator*()
157146
{
158147
return *(this->buffer);
159148
}
@@ -166,7 +155,8 @@ struct CheckedIndexer {
166155
* @param index Index to access in the buffer.
167156
* @return The character at the specified index or 0 if out of bounds.
168157
*/
169-
char_type operator[](size_t index)
158+
char_type
159+
operator[](size_t index)
170160
{
171161
if (index >= this->length) {
172162
return (char_type) 0;
@@ -183,7 +173,8 @@ struct CheckedIndexer {
183173
* @note If the specified number of elements to move exceeds the length of the buffer,
184174
* the indexer will be moved to the end of the buffer, and the length will be set to 0.
185175
*/
186-
CheckedIndexer<char_type> operator+(size_t rhs)
176+
CheckedIndexer<char_type>
177+
operator+(size_t rhs)
187178
{
188179
if (rhs > this->length) {
189180
rhs = this->length;
@@ -200,7 +191,8 @@ struct CheckedIndexer {
200191
* @note If the specified number of elements to move exceeds the length of the buffer,
201192
* the indexer will be moved to the end of the buffer, and the length will be set to 0.
202193
*/
203-
CheckedIndexer<char_type>& operator+=(size_t rhs)
194+
CheckedIndexer<char_type>&
195+
operator+=(size_t rhs)
204196
{
205197
if (rhs > this->length) {
206198
rhs = this->length;
@@ -217,7 +209,8 @@ struct CheckedIndexer {
217209
*
218210
* @note If the indexer is at the end of the buffer, this operation has no effect.
219211
*/
220-
CheckedIndexer<char_type> operator++(int)
212+
CheckedIndexer<char_type>
213+
operator++(int)
221214
{
222215
*this += 1;
223216
return *this;
@@ -231,7 +224,8 @@ struct CheckedIndexer {
231224
*
232225
* @note If the indexer moves backward past the start of the buffer, the behavior is undefined.
233226
*/
234-
CheckedIndexer<char_type>& operator-=(size_t rhs)
227+
CheckedIndexer<char_type>&
228+
operator-=(size_t rhs)
235229
{
236230
this->buffer -= rhs;
237231
this->length += rhs;
@@ -245,7 +239,8 @@ struct CheckedIndexer {
245239
*
246240
* @note If the indexer moves backward past the start of the buffer, the behavior is undefined.
247241
*/
248-
CheckedIndexer<char_type> operator--(int)
242+
CheckedIndexer<char_type>
243+
operator--(int)
249244
{
250245
*this -= 1;
251246
return *this;
@@ -257,7 +252,8 @@ struct CheckedIndexer {
257252
* @param rhs Another CheckedIndexer instance to compare.
258253
* @return The difference in pointers between the two indexers.
259254
*/
260-
std::ptrdiff_t operator-(CheckedIndexer<char_type> rhs)
255+
std::ptrdiff_t
256+
operator-(CheckedIndexer<char_type> rhs)
261257
{
262258
return this->buffer - rhs.buffer;
263259
}
@@ -270,7 +266,8 @@ struct CheckedIndexer {
270266
*
271267
* @note If the indexer moves backward past the start of the buffer, the behavior is undefined.
272268
*/
273-
CheckedIndexer<char_type> operator-(size_t rhs)
269+
CheckedIndexer<char_type>
270+
operator-(size_t rhs)
274271
{
275272
return CheckedIndexer(this->buffer - rhs, this->length + rhs);
276273
}
@@ -281,7 +278,8 @@ struct CheckedIndexer {
281278
* @param rhs Another CheckedIndexer instance to compare.
282279
* @return True if this indexer is greater than the right-hand side, otherwise false.
283280
*/
284-
int operator>(CheckedIndexer<char_type> rhs)
281+
int
282+
operator>(CheckedIndexer<char_type> rhs)
285283
{
286284
return this->buffer > rhs.buffer;
287285
}
@@ -292,7 +290,8 @@ struct CheckedIndexer {
292290
* @param rhs Another CheckedIndexer instance to compare.
293291
* @return True if this indexer is greater than or equal to the right-hand side, otherwise false.
294292
*/
295-
int operator>=(CheckedIndexer<char_type> rhs)
293+
int
294+
operator>=(CheckedIndexer<char_type> rhs)
296295
{
297296
return this->buffer >= rhs.buffer;
298297
}
@@ -303,7 +302,8 @@ struct CheckedIndexer {
303302
* @param rhs Another CheckedIndexer instance to compare.
304303
* @return True if this indexer is less than the right-hand side, otherwise false.
305304
*/
306-
int operator<(CheckedIndexer<char_type> rhs)
305+
int
306+
operator<(CheckedIndexer<char_type> rhs)
307307
{
308308
return this->buffer < rhs.buffer;
309309
}
@@ -314,7 +314,8 @@ struct CheckedIndexer {
314314
* @param rhs Another CheckedIndexer instance to compare.
315315
* @return True if this indexer is less than or equal to the right-hand side, otherwise false.
316316
*/
317-
int operator<=(CheckedIndexer<char_type> rhs)
317+
int
318+
operator<=(CheckedIndexer<char_type> rhs)
318319
{
319320
return this->buffer <= rhs.buffer;
320321
}
@@ -325,7 +326,8 @@ struct CheckedIndexer {
325326
* @param rhs Another CheckedIndexer instance to compare.
326327
* @return True if both indexers point to the same buffer, otherwise false.
327328
*/
328-
int operator==(CheckedIndexer<char_type> rhs)
329+
int
330+
operator==(CheckedIndexer<char_type> rhs)
329331
{
330332
return this->buffer == rhs.buffer;
331333
}

0 commit comments

Comments
 (0)