Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 15 Apr 2015 21:55:27 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: [GSoC] John the Ripper support for PHC finalists

On 2015-04-15 20:08, Agnieszka Bielec wrote:
> 2015-04-15 7:42 GMT-10:00 Alexander Cherepanov <ch3root@...nwall.com>:
>> On 30.03.2015 12:11, magnum wrote:
>>> Agnieszka, please note that in OpenCL an int is always 32-bit and long
>>> is always 64-bit. Long long is not used but is reserved; it may be used
>>> in the future eg. for 128-bit.
>>>
>>> So when porting C code, basically ULL should always be UL and you can
>>> replace all "long long" with long. On the same note, some reference code
>>> use long where they really only need 32-bit (because that's what you
>>> need to use to be really portable) and replacing that with int in a
>>> kernel can give a very significant speed boost.
>>
>> Perhaps it's better to use types like uint32_t etc. if we know which types
>> we need exactly and target platforms with different sizes?

Right now almost any system has int as 32 bits and long long as 64. But
things may change - they did before and will again eventually.

> I can modify pomelo to avoid problems with sizes in various platforms
> (I don't mean opencl)

For non-OpenCL, it may be a good idea. In Jumbo we use "stdint.h" as
opposed to <stdint.h> but the result is supposedly the same (the local
stdint.h calls the system one if available, and does the job itself
otherwise).

> but if the author of pomelo use unsigned long long, should I change it
> to uint64 ?

Generally speaking that would be a safe choice - and for Pomelo it's
almost certainly the right choice. When porting much older code (like
1990's or older - there's a lot of such code still around) you may find
that only uint32_t is needed for "long long" because it originally meant
32 bits on a 16-bit system...

I think what's most important is to never ever use "long" for anything
performance (or size) critical (except in OpenCL as already discussed).
It's 32-bit on some systems and 64-bit on others. Review the code and
change it to "long long" if that's really needed, otherwise just int. Or
like you said, just go with the C99 style.

magnum

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.