From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23081 invoked by alias); 27 Sep 2016 19:07:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 23072 invoked by uid 89); 27 Sep 2016 19:07:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: zimbra.cs.ucla.edu Subject: Re: [PATCH] [BZ 20628] make mallinfo saturating To: DJ Delorie , libc-alpha@sourceware.org References: From: Paul Eggert Message-ID: Date: Tue, 27 Sep 2016 19:07:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-09/txt/msg00539.txt.bz2 It would be more backward-compatible to represent minor overflows as negative numbers that are equivalent to the correct answers modulo (UINT_MAX + 1). That way, callers can continue to retrieve the correct values by casting int to unsigned. The code can use -1 to represent a value greater than UINT_MAX. This all should be doable just as efficiently as the proposed patch.