Skip to content

Commit 1e6ea20

Browse files
committed
inline.h: Comments fixed and added
(intended to be squashed before merge)
1 parent 4f3d212 commit 1e6ea20

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

inline.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,8 +3416,8 @@ S_lossless_NV_to_IV(const NV nv, IV *ivp)
34163416

34173417
/* Define IV_*_OVERFLOW_IS_EXPENSIVE below to nonzero value
34183418
* if strict overflow checks are too expensive
3419-
* (for example, for CPUs that has no hardware overflow detection flag).
3420-
* If these macro has nonzero value, or overflow-checking compiler intrinsics
3419+
* (for example, for CPUs that have no hardware overflow detection flags).
3420+
* If these macros have nonzero value, or overflow-checking compiler intrinsics
34213421
* are not available, good-old heuristics (with some false positives)
34223422
* will be used. */
34233423
# ifndef IV_ADD_SUB_OVERFLOW_IS_EXPENSIVE
@@ -3466,6 +3466,10 @@ S_iv_add_may_overflow (IV il, IV ir, IV *const result)
34663466
PERL_STATIC_INLINE bool
34673467
S_uv_add_overflow (UV auv, UV buv, UV *const result)
34683468
{
3469+
/* (auv + buv) < auv means that the addition wrapped around,
3470+
i.e. overflowed. Note that unsigned integer overflow is well-defined
3471+
in standard C to wrap around, in constrast to signed integer overflow
3472+
whose behaviour is undefined. */
34693473
return (*result = auv + buv) < auv;
34703474
}
34713475
# endif

0 commit comments

Comments
 (0)