From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 0623628554 for ; Thu, 29 Feb 2024 00:18:54 +0100 (CET) Received: (qmail 24469 invoked by uid 550); 28 Feb 2024 23:15:13 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 24434 invoked from network); 28 Feb 2024 23:15:13 -0000 Date: Wed, 28 Feb 2024 23:14:27 +0000 (UTC) From: Thorsten Glaser X-X-Sender: tg@herc.mirbsd.org To: musl@lists.openwall.com cc: James Tirta Halim In-Reply-To: Message-ID: References: <20240227140756.216904-1-tirtajames45@gmail.com> <20240227144926.GK4163@brightrain.aerifal.cx> <20240227145123.GL4163@brightrain.aerifal.cx> Content-Language: de-Zsym-DE-1901-u-em-text-rg-denw-tz-utc, en-Zsym-GB-u-cu-eur-em-text-fw-mon-hc-h23-ms-metric-mu-celsius-rg-denw-tz-utc-va-posix MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Subject: Re: [musl] [PATCH] add memcmpeq: memcmp that returns length of first mismatch Markus Wichmann dixit: >> > > +=09for (; n >=3D sizeof(word) && *(word *)p1 =3D=3D *(word *)p2; p1= +=3Dsizeof(word), p2+=3Dsizeof(word), n-=3Dsizeof(word)); Very much UB. >4. All the other musl C code avoids misaligned word access. I don't know >which architecture/ABI doesn't allow it, but it is nevertheless the Almost all of them. i386/amd64 penalise it heavily and it can cause trouble when crossing page sizes, cacheline sizes, etc. as well. On alpha, many ARM, SPARC, and others, it=E2=80=99s an instant SIGBUS/SIGSEGV. bye, //mirabilos --=20 I believe no one can invent an algorithm. One just happens to hit upon it when God enlightens him. Or only God invents algorithms, we merely copy the= m. If you don't believe in God, just consider God as Nature if you won't deny existence.=09=09-- Coywolf Qi Hunt