From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76791 invoked by alias); 14 Feb 2020 20:21:36 -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 76775 invoked by uid 89); 14 Feb 2020 20:21:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:864 X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581711693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hvXrUYHOUCiJO7sWDcz1j92Ucblgazjh0pw8M3sbLOA=; b=Y6ZnGE8TBInqt/RrrAVrTEoso+Ny9+xkIGwBi010Ez9syaZrAixt6lJlwQe8Ht83JUeEcZ 1QCga7/d7KBn+X4BHX5T6GWLYGlz3MyIGA81dJ2PLgW8adGqKqwVMErjk29GIDK8zite6A DU6mb+9vMtjnCq6oQ9JytWUtpW9dzS4= From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 1/3] : Add type safety and port to Hurd References: <1cdfa358-5bc0-56b7-89d2-0f7cfd4d4fc0@linaro.org> Date: Fri, 14 Feb 2020 20:21:00 -0000 In-Reply-To: <1cdfa358-5bc0-56b7-89d2-0f7cfd4d4fc0@linaro.org> (Adhemerval Zanella's message of "Fri, 14 Feb 2020 16:08:05 -0300") Message-ID: <87a75kzzqz.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-SW-Source: 2020-02/txt/msg00683.txt.bz2 * Adhemerval Zanella: > Do we really such optimization which results in somewhat complicate > code? Couldn't we use something simple as: > > char * > __fd_to_filename (int descriptor, struct fd_to_filename *storage) > { > char *buf =3D storage->buffer; > int i, j; > > for (i =3D 0; (buf[i] =3D FD_TO_FILENAME_PREFIX[i]); i++); > if (descriptor =3D=3D 0) > { > buf[i] =3D '0'; > buf[i+1] =3D '\0'; > return storage->buffer; > } > > for (j =3D descriptor; j !=3D 0; j /=3D 10, i++); > buf[i] =3D '\0'; > for (; descriptor !=3D 0; descriptor /=3D 10)=20 > buf[--i] =3D '0' + descriptor % 10; > > return storage->buffer; > } I don't have a strong opinion about this (but I think we should probably keep the mempcpy). Most descriptors will be fairly small, so the smaller code size is probably more important. Thanks, Florian