15:34 < szt_> https://github.com/radare/radare2/blob/master/libr/anal/esil.c#L186 what reason to do this? 15:35 < szt_> esil->cur & (ut64) ( 1 << 1 ); esil->cur & (ut64) ( 1 << 2 ); etc 15:36 < szt_> maybe just use loop 15:38 < szt_> or lookup table 15:39 < szt_> https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetNaive 15:39 < szt_> pancake 15:59 < jvoisin> pancake: I already have some customers for the calendar. 16:08 < jvoisin> szt_: send a patch ♥ 16:11 < szt_> jvoisin, https://graphics.stanford.edu/~seander/bithacks.html#ParityNaive what parity computing method you prefer? 16:12 < szt_> Can use 64-bit integer? 16:12 < szt_> unsigned char b; // byte value to compute the parity of 16:12 < szt_> bool parity = 16:12 < szt_> (((b * 0x0101010101010101ULL) & 0x8040201008040201ULL) % 0x1FF) & 1; 16:13 < jvoisin> just use a loop 16:14 < jvoisin> plz no magic numbers :/ 16:14 < szt_> loop - slow 16:14 < szt_> bithacks - fun 16:15 < jvoisin> maintainance-- 16:15 < szt_> / comments what this code do 16:15 < szt_> and maybe some loop code for reference 16:16 < szt_> commented 16:17 < jvoisin> the compiler will optimize it anyway 16:17 < jvoisin> write readable code :/ 16:21 < szt_> no, compiler is unable to optimize this things 16:22 < szt_> http://gcc.godbolt.org/ you can play with this 16:31 < szt_> http://goo.gl/TYsMrA assembly comparsion 16:39 < szt_> btw look at clang clang http://goo.gl/1VnP23 16:39 < szt_> redare2_parity_test(unsigned char): # @redare2_parity_test(unsigned char) 16:39 < szt_> xor edi, 1 16:39 < szt_> mov eax, edi 16:39 < szt_> ret 16:43 < szt_> xvilka__, look at http://goo.gl/1VnP23 and https://github.com/radare/radare2/blob/master/libr/anal/esil.c#L186 16:44 < szt_> why code in clang compiles into 16:44 < szt_> xor edi, 1 16:44 < szt_> mov eax, edi 16:44 < szt_> ret 16:46 < szt_> bug? 16:53 < xvilka__> szt_: yep, bug 16:57 < szt_> consider to use faster parity check algorithm. 16:57 < szt_> and bug-free 16:57 < szt_> I don't know what algo is better for this case 16:59 < xvilka___> szt_: send a bugreport to the clang/llvm pls 17:07 < szt_> xvilka___, hmm... I think this is not clang bug 17:07 < szt_> something wrong with this code 17:08 < szt_> It does not check parity 17:11 < szt_> To check parity you need something like 17:11 < szt_> bits ^= !!(esil->cur & (ut64) 1); 17:11 < szt_> bits ^= !!(esil->cur & (ut64) ( 1 << 1 )); 17:11 < szt_> bits ^= !!(esil->cur & (ut64) ( 1 << 2 )); 17:11 < szt_> etc 17:12 < xvilka___> szt_: despite the real purpose of that code, it is still a clang bug. because that code _can't_ be compressed in just xor 1 17:14 < szt_> xvilka___, no, it can. You xor-ing every bit of some variable with variable which equal 1 at start 17:15 < szt_> so xor edi, 1 do exactly the same 17:15 < szt_> not a clang bug 17:16 < dx> i'm skimming that conversation, but are you saying that something behaves correctly with gcc, misbehaves with clang, and isn't clang's fault? 17:18 < szt_> I think all OK with clang and gcc. Just bug in radare2 17:19 < szt_> btw sometimes i finding some bugs in GCC 17:19 < szt_> sorry my english 17:25 < xvilka___> hm 17:25 < xvilka___> szt_: missed the bits = 1 part 17:25 < xvilka___> szt_: yes, you right 17:25 < xvilka___> szt_: pls send PR 17:26 < szt_> What means "send PR"? 17:27 < dx> yeah i just finished doing my own testing 17:28 < szt_> pull request 17:29 < szt_> xvilka___, but what bit parity check is better for this case? 17:29 < szt_> I am not sure 17:29 < xvilka___> szt_: the thing you've suggested looks o 17:29 < xvilka___> k 17:52 < szt_> xvilka___, https://github.com/radare/radare2/pull/3139 17:54 < dx> fancy 17:55 < dx> "The method above takes around 4 operations, but only works on bytes" 17:57 < dx> esil->cur is ut64 18:09 -!- condret [~condret@unaffiliated/condret] has joined #radare 18:10 < szt_> (esil->cur & 0xff) 18:10 < szt_> 8 bit 18:10 < condret> waaat 18:10 < condret> where does dat happen 18:10 < condret> pancake: ping 18:13 < dx> szt_: oh i see it says least significant byte. nevermind 18:13 < crowell> morn 18:13 < dx> condret: context is https://github.com/radare/radare2/pull/3139 18:17 < condret> black magic 18:19 < condret> i did a comment on it 18:19 < dx> condret: context is: it didn't