Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 13 May 2012 22:12:36 +0200
From: magnum <>
Subject: Re: OpenCL SWAP64 on 7970

On 05/13/2012 06:44 PM, Samuele Giovanni Tonon wrote:
> On 05/12/12 19:41, myrice wrote:
>> On Fri, May 11, 2012 at 11:30 PM, Samuele Giovanni Tonon
>> <> wrote:
>>> maybe i'm totally wrong but have you tried wzyx notation or - better -
>>> variable.s76543210 ?
>> I haven't used it. I think it is belong to later optimization? or you
>> mean I can use uchar8 instead of ulong to avoid bitwise  operation
>> problem?

He means a 64-bit variant of this:

#define SWAP32(a)       (as_uint(as_uchar4(a).wzyx))

it can also be written this way (exactly the same meaning):

#define SWAP32(a)       (as_uint(as_uchar4(a).s3210))

It's just vector typecasting and back to uint, you would not change
anything else than your swap macro. I suppose he did something like this:

#define SWAP64(n)	as_uint64_t(as_uchar8(n).s76543210)

However, I'm not sure you can trust that this works on any platform (I
believe the 32-bit version is safe though - it's widely used).


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.