Skip to content

Commit 03bc6bb

Browse files
committed
address comments
1 parent 87e9d63 commit 03bc6bb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ext/bcmath/libbcmath/src/str2num.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,33 +76,33 @@ static const char *bc_count_digits(const char *str, const char *end)
7676
return str;
7777
}
7878

79-
static inline const char *bc_skip_zero_reverse(const char *str, const char *end)
79+
static inline const char *bc_skip_zero_reverse(const char *scaner, const char *stop)
8080
{
8181
/* Check in bulk */
8282
#ifdef __SSE2__
83-
const __m128i c_zero_repeat = _mm_set1_epi8((signed char) '0');
84-
while (str - sizeof(__m128i) >= end) {
85-
str -= sizeof(__m128i);
86-
__m128i bytes = _mm_loadu_si128((const __m128i *) str);
83+
const __m128i c_zero_repeat = _mm_set1_epi8('0');
84+
while (scaner - sizeof(__m128i) >= stop) {
85+
scaner -= sizeof(__m128i);
86+
__m128i bytes = _mm_loadu_si128((const __m128i *) scaner);
8787
/* Checks if all numeric strings are equal to '0'. */
8888
bytes = _mm_cmpeq_epi8(bytes, c_zero_repeat);
8989

9090
int mask = _mm_movemask_epi8(bytes);
9191
/* The probability of having 16 trailing 0s in a row is very low, so we use EXPECTED. */
9292
if (EXPECTED(mask != 0xffff)) {
9393
/* Move the pointer back and check each character in loop. */
94-
str += sizeof(__m128i);
94+
scaner += sizeof(__m128i);
9595
break;
9696
}
9797
}
9898
#endif
9999

100100
/* Exclude trailing zeros. */
101-
while (str - 1 >= end && str[-1] == '0') {
102-
str--;
101+
while (scaner - 1 >= end && scaner[-1] == '0') {
102+
scaner--;
103103
}
104104

105-
return str;
105+
return scaner;
106106
}
107107

108108
/* Assumes `num` points to NULL, i.e. does yet not hold a number. */

0 commit comments

Comments
 (0)