From owner-freebsd-hackers@FreeBSD.ORG Mon May 27 03:54:56 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5FAFD351 for ; Mon, 27 May 2013 03:54:56 +0000 (UTC) (envelope-from lee_thomas@aslantools.com) Received: from roproxy1-pub.unifiedlayer.com (roproxy1-pub.unifiedlayer.com [69.89.25.95]) by mx1.freebsd.org (Postfix) with SMTP id 1FC24F0E for ; Mon, 27 May 2013 03:54:55 +0000 (UTC) Received: (qmail 20179 invoked by uid 0); 27 May 2013 03:54:52 -0000 Received: from unknown (HELO mailchannelsproxy2.unifiedlayer.com) (66.147.243.71) by roproxy1.unifiedlayer.com with SMTP; 27 May 2013 03:54:52 -0000 X-Sender-Id: {:fast21.fastdomain.com:lthomasn:fast21.fastdomain.com} {sentby:program running on server} Received: from fast21.fastdomain.com (fast21.fastdomain.com [74.220.199.21]) by 0.0.0.0:2500 (trex/4.8.69); Mon, 27 May 2013 03:54:52 GMT Received: from localhost ([127.0.0.1]:49473 helo=fast21.fastdomain.com) by fast21.fastdomain.com with esmtp (Exim 4.80) (envelope-from ) id 1Uga8I-0007nG-Hp for freebsd-hackers@freebsd.org; Sun, 26 May 2013 06:33:06 -0600 To: Subject: Re: Performance improvement to strnlen(). X-PHP-Script: aslantools.com/mail/index.php for 173.71.114.222 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sun, 26 May 2013 08:33:06 -0400 From: Lee Thomas Organization: Aslan Tools In-Reply-To: References: Message-ID: <3004a58e86f2eca25a3541db518ea133@lthomas.net> X-Sender: lee_thomas@aslantools.com User-Agent: Roundcube Webmail/0.8.4 X-Identified-User: {:fast21.fastdomain.com:lthomasn:fast21.fastdomain.com} {sentby:program running on server} X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 May 2013 03:54:56 -0000 On 2013-05-26 08:00, Václav Zeman wrote: > On 05/25/2013 10:27 PM, Lee Thomas wrote: >> + lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK); >> + va = (*lp - mask01); >> + vb = ((~*lp) & mask80); > I do not think that this correct C. This is type punning violating > the > rules of the language. Hello Václav, The aliasing here is safe, because there are no writes through either of the pointers. Regards, Lee Thomas