From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 581D73851C33; Tue, 6 Oct 2020 19:09:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 581D73851C33 Received: by mail-wr1-x42b.google.com with SMTP id e17so6003739wru.12; Tue, 06 Oct 2020 12:09:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=ERsS2hH51y9J9A1kAyusS0bE1sqGrrSmiJdBdzj0WdA=; b=DagPv5A+VE3gb7T5JbzZAh/1HQn1wDab2XpNI0QkmopW5gkCNMZ2WvwEyDkBlkkeDH VhiI1VUihAy5qIc83d/Eu+HYd12iEHk2qmM99N4CU9dMoUv1zJT7BS5rLMSwxLfMbwjo LXQzYq8Sb60ga5cPjrWe414DQKu4Wit6p8OInsODVA2TIwv+42IJ4B5b3WGoTnsZA9H+ AMEqeSBIj49tiDjMne4qiJfcjpewnyaKF0MOBujUDZr2TyV9nG+xCIAFTNKyROxAFAzp 8glLR4JnOjpHLIwCPszPv27A2kGme11aZJvtNvf35/Xm+aba4l+9dGeh2UY5KnksEpTA GBpg== X-Gm-Message-State: AOAM5320gDSZ8oxSpqZqyEiSDIpq/M4yZdZAl2/LebufAYtoXVyoXDnU xV0Di+iy8EiNovufSeYKMxo0keOuobjZey603HA= X-Google-Smtp-Source: ABdhPJyKO97Y7s8eqlxXTPVyf3Uh27LbsRuf6Emkk90PQBZZTOKsn1F3bACdGeW7JQU+IWwHYYfXGmPT+bUdYuqA8MY= X-Received: by 2002:a5d:5106:: with SMTP id s6mr6464059wrt.51.1602011398274; Tue, 06 Oct 2020 12:09:58 -0700 (PDT) MIME-Version: 1.0 References: <20201005232515.GD7004@redhat.com> <20201005234031.GF7004@redhat.com> In-Reply-To: <20201005234031.GF7004@redhat.com> Reply-To: lemire@gmail.com From: Daniel Lemire Date: Tue, 6 Oct 2020 15:09:47 -0400 Message-ID: Subject: Re: [PATCH, libstdc++] Improve the performance of std::uniform_int_distribution (fewer divisions) To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2020 19:10:00 -0000 > > >The condition above checks that __urngrange == 2**64-1 which means > >that U::max() - U::min() is the maximum 64-bit value, which means > >means U::max()==2**64-1 and U::min()==0. So if U::min() is 0 we don't > >need to subtract it. > That sounds correct.