Skip to content

Commit 3c6483c

Browse files
committed
S_uiv_2buf: code quality improvements suggested in GH#22927
1 parent f0f3175 commit 3c6483c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: sv_inline.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -1055,14 +1055,16 @@ S_uiv_2buf(char *const buf, const IV iv, UV uv, const int is_uv, char **const pe
10551055
word_ptr = (U16*)ptr;
10561056
word_table = (U16*)Perl_int2str_table.arr;
10571057

1058-
if (UNLIKELY(is_uv))
1058+
if (is_uv)
10591059
sign = 0;
10601060
else if (iv >= 0) {
10611061
uv = iv;
10621062
sign = 0;
10631063
} else {
1064-
/* Using 0- here to silence bogus warning from MS VC */
1065-
uv = (UV) (0 - (UV) iv);
1064+
/* This is NEGATE_2UV(iv), which can be found in handy.h. */
1065+
/* sv_inline.h does not include handy.h because the latter
1066+
* would then get included twice into .c files. */
1067+
uv = (ASSUME((iv) < 0), (UV)-((iv) + 1) + 1U);
10661068
sign = 1;
10671069
}
10681070

0 commit comments

Comments
 (0)