From patchwork Sun Nov 26 16:38:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Monakov X-Patchwork-Id: 169890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2571365vqx; Sun, 26 Nov 2023 08:39:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRGdwaEV1x93oZBzi18hHSEcHleR+fvZkve7d/X18sYc59JFQaFMF0mM9oADoJ10CeWa0+ X-Received: by 2002:a05:622a:588d:b0:423:bc3f:8304 with SMTP id fh13-20020a05622a588d00b00423bc3f8304mr1372798qtb.54.1701016768172; Sun, 26 Nov 2023 08:39:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701016768; cv=pass; d=google.com; s=arc-20160816; b=SusV9bnWhAeq1XK5znNhrHSz9m7/EkmKPqxWPc+nkfC9L+OrZoOsgFwYKdFKz/qhbX mV11EM/3mz7TfnU5pEU1YU213CthIR77A7kArzGbnZYSusnz5tbtskSA3zNMWx4BhL56 EHT6hmb+rxVIp69DJvqW4ZkJvGCW2L5Koxl2GEVRRZR8qHdJfVVLgzdZhgDD1QywOAH5 h6nDEyiQT3aloy5XHNVLAOzGWMpsgrnYlJaLKv3ZmRIiRPUTM6l5RZjooTtwOOomLD4D fJ56dMEwMO2l5cuBGpYy+Lh1tLZuKSsp9hcV82ab2rz/BhSkSEInGFN8RFtyDBNv2hRY VEzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-filter :arc-filter:dmarc-filter:delivered-to; bh=jZTAvHBfaBcCEp8c5MLKHuFuQfyuuUWjReOPbJOJt8E=; fh=MvR8A0pSjrUqU8yw0r8byPaB9PNsTYG/aojlkuGKt6U=; b=XBXETOOsUcgnxNc9nRh0EaTr0KmRZt+iHhmaJJEvun3O3DfkELpG4p1CtP2uYpOuy3 xE/z+B4+Dk7i5HOJYJkzY797AHwXmhJms0ewojRLL8/652pFqZrh+SgjMgzc0a5i6PBq bcQrvEoQGIhHuv7F3sM2kZDgtg5qanf2Pdr98iTUjE7e+Tm77nEwe9uF/n2HJuB5nIHA 2PLhmt8yMRtsVg5YSezcOgqRzqiJoKi9RlyvA7+byIz/nPt9L0EPtGH1LazhYU8RjjOC dvGE4fw0HoGMRb8WP2mXbH54BYllxHF0TI96gdGezGSa6HqglWQjwUehyCScHmzVtCpb 02pQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j11-20020ac85c4b000000b00423794c99a1si7610886qtj.362.2023.11.26.08.39.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 08:39:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB53438582A7 for ; Sun, 26 Nov 2023 16:39:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id A04733858296 for ; Sun, 26 Nov 2023 16:39:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A04733858296 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ispras.ru ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A04733858296 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=83.149.199.84 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701016745; cv=none; b=MuN5dnINh4t3dq1IanV+9W2VIMWxnLlckJufI3FhKZv0ZCtltpbBW/mqfLgxpYyJeX04bVuTyP7xV7ogd+U3BsYydSjE2jNRfz4HEoldhp7shQfq32Puxv+xSgHnboVf7gc9LhQaNB12AoHNrvFsxTDSlB+DmjxVYfTCg0foY5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701016745; c=relaxed/simple; bh=xBZvWTDQ8GDeRJwaMSV3gGFPV42u/ajaocF/4ccXaiA=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=UMB+s+LXbbu60T5uZkf104iOX/5ugtZfBvBQAaE8kBiw994EJTK98J4t+YGoCNlnVBVewj2mRmjokJ2b17nKzxAYXQ7CgoKWSOb9crrL6660ksZ00/zX2OnHbryH+MQTZOXwOOHNmqBz1S7Jjl7PEoXmj+osvlHkQgvWjTNOaII= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.intra.ispras.ru (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTP id 1073140F1DEE; Sun, 26 Nov 2023 16:39:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 1073140F1DEE From: Alexander Monakov To: gcc-patches@gcc.gnu.org Cc: Alexander Monakov Subject: [committed] sort.cc: fix mentions of sorting networks in comments Date: Sun, 26 Nov 2023 19:38:58 +0300 Message-Id: <20231126163858.9328-1-amonakov@ispras.ru> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783645359053980392 X-GMAIL-MSGID: 1783645359053980392 Avoid using 'network sort' (a misnomer) in sort.cc, the correct term is 'sorting networks'. gcc/ChangeLog: * sort.cc: Use 'sorting networks' in comments. --- gcc/sort.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/sort.cc b/gcc/sort.cc index 9a0113fb62f..feef345830c 100644 --- a/gcc/sort.cc +++ b/gcc/sort.cc @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see - deterministic (but not necessarily stable) - fast, especially for common cases (0-5 elements of size 8 or 4) - The implementation uses a network sort for up to 5 elements and + The implementation uses sorting networks for up to 5 elements and a merge sort on top of that. Neither stage has branches depending on comparator result, trading extra arithmetic for branch mispredictions. */ @@ -53,7 +53,7 @@ struct sort_ctx char *out; // output buffer size_t n; // number of elements size_t size; // element size - size_t nlim; // limit for network sort + size_t nlim; // limit for using sorting networks }; /* Like sort_ctx, but for use with qsort_r-style comparators. Several @@ -151,7 +151,7 @@ cmp1 (char *e0, char *e1, sort_ctx *c) return x & (c->cmp (e0, e1) >> 31); } -/* Execute network sort on 2 to 5 elements from IN, placing them into C->OUT. +/* Apply a sorting network to 2 to 5 elements from IN, placing them into C->OUT. IN may be equal to C->OUT, in which case elements are sorted in place. */ template static void