
Date: Fri, 23 Aug 2013 02:31:46 +0100 From: Rafael Waldo Delgado Doblas <lord.rafa@...il.com> To: johndev@...ts.openwall.com Subject: Re: Parallella: Litecoin mining Hello, 2013/8/23 Rafael Waldo Delgado Doblas <lord.rafa@...il.com> > Sorry I forgot about it, but currently I don't understand. > > (x/6) = x * (1/6) = (x * (n/6)) / n, well I choose I nice power of 2 n the > down division can be replaced by a m shift and the upper (n/6) can be > computer and round it. for example if I say n = 16. > > (x/6) = (x * (16/6)) >> 4 ~ (x * 3) >> 4. > > I need to do a right shift by 1 how do you find the constant for right > shift by 1 > > Regards, > Rafael. > Ok I have replaced the division and modules by : // This function approximation works fine up to a = 32771 #define DIVTMTO(a) ((10923 * (a))>>16) // If TMTO_RATIO changes you need redefine this macro #define DIV2(a) ((a)>>1) #define MOD2(a) ((a)  (DIV2(a) << 1)) // This can be optimised in ASM using carry #define DIV8(a) ((a)>>3) #define MOD8(a) ((a)  (DIV8(a) << 3)) // This can be optimised in ASM using carry The performance still the same but now I drop almost 1K. I'm going to check the segfault. Regards, Rafael. [ CONTENT OF TYPE text/html SKIPPED ]
Powered by blists  more mailing lists