Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 58201 invoked from network); 22 May 2009 13:01:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 May 2009 13:01:29 -0000 Received: (qmail 23169 invoked by uid 500); 22 May 2009 13:01:41 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 23067 invoked by uid 500); 22 May 2009 13:01:41 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 23035 invoked by uid 99); 22 May 2009 13:01:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 May 2009 13:01:38 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of oliver.deakin@googlemail.com designates 209.85.220.212 as permitted sender) Received: from [209.85.220.212] (HELO mail-fx0-f212.google.com) (209.85.220.212) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 May 2009 13:01:27 +0000 Received: by fxm8 with SMTP id 8so1624692fxm.36 for ; Fri, 22 May 2009 06:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=wsziyKZTB3c0X+9tq8/k72i0Lh3ri+svcm06u2s1JQY=; b=xiybO/RMuAKMt0vPBbu1MhlLxA9112xsH2+BL1p72A7XeJjBbm0teR2GyrTCVJaXtN zdd36QG2GbtyBsqHWCGa6epOm6SYGvl3EZF+0G6vMdZd70NwZnF0CESHlNI6v0ycGAaL 7bsdcnZ2UNAmUSQw93Bh3VHapEBPORDFcU0wA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=MP4a6tFfJ6DLNfInLpi5jaM838aMYtfap5HF33cz8+cWPE5Tx4YC/L0XH3oNN2x2j9 yi9IQCmy7DWd2jiATmYbI30I5qWok/GClauyUrqdJFj6xktIphUCmpz+/ty+Vmj7wyYl P8Lnweg2HitCDbKxrz3iOpGhxg4b5hFZJOFJE= Received: by 10.86.53.8 with SMTP id b8mr3137548fga.32.1242997265963; Fri, 22 May 2009 06:01:05 -0700 (PDT) Received: from ?9.20.183.159? (blueice4n2.uk.ibm.com [195.212.29.92]) by mx.google.com with ESMTPS id e20sm910802fga.10.2009.05.22.06.01.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 22 May 2009 06:01:04 -0700 (PDT) Message-ID: <4A16A212.1090809@googlemail.com> Date: Fri, 22 May 2009 14:01:06 +0100 From: Oliver Deakin User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: dev@harmony.apache.org Subject: Re: [classlib][misc] MemMacros.h get_unaligned and set_unaligned macros fail to compile on zLinux References: <4A15789A.1050702@googlemail.com> In-Reply-To: <4A15789A.1050702@googlemail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org The change I appended to my original mail fixes the build problem on zLinux 31 now. Can anyone confirm that everything works as expected on Linux x86_64 please? I think it is only that platform that is in danger of being affected by this modification. Regards, Oliver Oliver Deakin wrote: > Hi all, > > I have a quick question about the macros get_unaligned() and > set_unaligned() in MemMacros.h. When compiling on zSeries Linux 31 bit > systems we fall into the macros defines section for IPF machines > because we are on linux and __386__ is not defined. Unfortunately the > "(const void*) (ptr)" tries to cast a jlong (64 bit) to a 32 bit > pointer here and we get a "cast to pointer from integer of different > size" warning which is treated as an error. > > I'd like to fix the code to do the right thing here across all > platforms. Does anyone know this code well? Does the IPF section > (__linux__ && !__i386__) refer to Itanium machines only and not > x86_64? If so, would it suffice to replace the code that is there with > something like [1], so that only Itanium machines use the memmove() > based macros and all the rest (linux, windows, zos, aix etc.) use the > simpler cast based macros? > > Thanks for any help you can give! > > Regards, > Oliver > > [1] > #if defined(__ia64__) && defined(__linux__) > > #include > #define get_unaligned(type, ptr) \ > ({ \ > type __tmp; \ > memmove(&__tmp, (const void*) (ptr), sizeof(type)); \ > __tmp; \ > }) > > #define set_unaligned(type, ptr, val) \ > ({ \ > memmove((void*) (ptr), &val, sizeof(type)); \ > (void)0; \ > }) > > #else > > #define get_unaligned(type, ptr) ( *((type *)((uintptr_t)(ptr))) ) > #define set_unaligned(type, ptr, val) ( (void) (*((type > *)((uintptr_t)(ptr))) = val) ) > > #endif > -- Oliver Deakin Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU