Re: [dev] dwm bit fields conversion

2013-07-15 Thread Roberto E. Vargas Caballero

I usually use bitfields when there are a lot of items (for example
st glyph could be a good case for them). In other cases you waste
more memory with the access code that the space you save compacting
the bits in the struct.


> I should check generated code, but usually a mov is faster than mov+and+mov 
> for setting a bit.
> 
> On Jul 14, 2013, at 23:22, Markus Teich  wrote:
> 
> > Since this is just uncommon syntax (at least I haven't seen it before) and 
> > it is just used in the declaration I would be ok with it, if an additional 
> > comment explains it. It's not a strong opinion though, just an idea.


--
Roberto E. Vargas Caballero

k...@shike2.com
http://www.shike2.com



Re: [dev] [sbase] Patch to make md5 and sha1 more similar

2013-07-15 Thread sin
On Mon, Jul 15, 2013 at 02:00:35AM +0200, Jens Nyberg wrote:
> Hi,
> 
> I've included a patch that makes minor changes to md5 and sha1. Both
> hashing functions are pretty similar but the code differed in a few places
> so I cleaned them both up a bit.
> 
> Also I made some minor changes like moving the rol function to below the
> definitions and also instead of *= 8 I did a <<= 3 which is functionally
> equivalent but should save a tiny bit of speed (unless the compiler is
> smart enough to catch that and replaces it automatically).

I'd break this patch into multiple patches.  The change from *= 8 to <<= 3
doesn't make sense.  Maybe it did in the 80s but not anymore.



Re: [dev] [sbase] Patch to make md5 and sha1 more similar

2013-07-15 Thread Andreas Krennmair

* sin  [2013-07-15 12:20]:

I'd break this patch into multiple patches.  The change from *= 8 to <<= 3
doesn't make sense.  Maybe it did in the 80s but not anymore.


Just for the sake of completeness: there's a rather interesting presentation 
from a few years ago that explains in detail how clever compilers really are 
with their optimizations: 
http://www.fefe.de/source-code-optimization.pdf


Andreas



Re: [dev] [sbase] Patch to make md5 and sha1 more similar

2013-07-15 Thread Jens Nyberg
Hehe and I almost thought about changing to (x & 0x3f) instead of (x % 64)
but decided to skip that one =)

The more you know!


2013/7/15 Andreas Krennmair 

> * sin  [2013-07-15 12:20]:
>
>  I'd break this patch into multiple patches.  The change from *= 8 to <<= 3
>> doesn't make sense.  Maybe it did in the 80s but not anymore.
>>
>
> Just for the sake of completeness: there's a rather interesting
> presentation from a few years ago that explains in detail how clever
> compilers really are with their optimizations: http://www.fefe.de/source-*
> *code-optimization.pdf 
>
> Andreas
>
>


Re: [dev] [dwm] [patch] Fix warning about XKeycodeToKeysym

2013-07-15 Thread Alexander Rødseth
Hi,

I read the git log after having submitted the patch and I understand
that this issue has been looked at and various solutions has been
considered already. Hopefully there will be a good way to resolve this
in the future.

Thanks for the feedback on the patch!

Best regards,
Alexander Rødseth



Re: [dev] [sbase] Patch to make md5 and sha1 more similar

2013-07-15 Thread Szabolcs Nagy
* Jens Nyberg  [2013-07-15 16:51:29 +0200]:
> Hehe and I almost thought about changing to (x & 0x3f) instead of (x % 64)
> but decided to skip that one =)
> 

note that
x&63 and x%64
x>>6 and x/64
x<<6 and x*64
are not the same when x might be negative

(if x is negative then x&63 depends on the signed int representation,
but guaranteed to be in [0,63] while x%64 is in [-63,0], x>>6 is
implementation defined and usually very different from x/64 and
x<<6 is undefined while x*64 is only undefined when it overflows)

so the compiler (and you) can only interchange these freely
if it can be proven that x cannot be negative
(eg because its type is unsigned)



Re: [dev] [sbase] Patch to make md5 and sha1 more similar

2013-07-15 Thread Thorsten Glaser
Andreas Krennmair dixit:

> from a few years ago that explains in detail how clever compilers really are
> with their optimizations: http://www.fefe.de/source-code-optimization.pdf

“Learn what the compiler does” – did anyone do that for pcc recently?
I’m sure it does _not_ do all those uber-optimisations, and I believe
that “it made sense last century but not now” is wrong for easy, low‐
hanging fruits like shifts and bitmasks (but that prematurely writing
complex stuff that makes code illegible is still undesirable).

bye,
//mirabilos
-- 
In traditional syntax ' is ignored, but in c99 everything between two ' is
handled as character constant.  Therefore you cannot use ' in a preproces-
sing file in c99 mode.  -- Ragge
No faith left in ISO C99, undefined behaviour, etc.



Re: [dev] [sbase] Patch to make md5 and sha1 more similar

2013-07-15 Thread Jens Nyberg
I changed the bitshifting back as suggested. It was just confusing.

Attached the new patch.


2013/7/15 Thorsten Glaser 

> Andreas Krennmair dixit:
>
> > from a few years ago that explains in detail how clever compilers really
> are
> > with their optimizations:
> http://www.fefe.de/source-code-optimization.pdf
>
> “Learn what the compiler does” – did anyone do that for pcc recently?
> I’m sure it does _not_ do all those uber-optimisations, and I believe
> that “it made sense last century but not now” is wrong for easy, low‐
> hanging fruits like shifts and bitmasks (but that prematurely writing
> complex stuff that makes code illegible is still undesirable).
>
> bye,
> //mirabilos
> --
> In traditional syntax ' is ignored, but in c99 everything between two ' is
> handled as character constant.  Therefore you cannot use ' in a preproces-
> sing file in c99 mode.  -- Ragge
> No faith left in ISO C99, undefined behaviour, etc.
>
>


0001-More-consistancy-between-md5-and-sha1.patch
Description: Binary data