From b028fe596c0ac3c6fe686fa1a8026140550d9830 Mon Sep 17 00:00:00 2001 From: Rose Date: Thu, 29 Jul 2021 12:46:02 -0400 Subject: [PATCH] Remove rarely true check While it is faster to just leave when the source and destination are the same, most programmers would not make that mistake, and if they did, it would be a rarity and a reflection of something going wrong in their code in the first place. There is no reason to do this check if speed and code size are of utmost importance. --- stl/inc/xstring | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stl/inc/xstring b/stl/inc/xstring index 68795c0c58a..ea7153b6c05 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -90,10 +90,6 @@ struct _Char_traits { // properties of a string or stream element // If _First1 is in the src range, we need a backward loop. // Otherwise, the forward loop works (even if the back of dest overlaps the front of src). - if (_First1 == _First2) { - return _First1; // Self-assignment; either loop would work, but returning immediately is faster. - } - // Usually, we would compare pointers with less-than, even though they could belong to different arrays. // However, we're not allowed to do that during constant evaluation, so we need a linear scan for equality. bool _Loop_forward = true;