cpu detection

Andre Gemuend scroogie at scroogie.de
Wed Oct 31 09:12:26 UTC 2012

On 10/30/2012 11:49 PM, JL VT wrote:
> On Mon, Oct 29, 2012 at 9:18 AM, Dmitry Kazakov <dimula73 at gmail.com> wrote:
>> Well, the integer solution might be quite good idea for some of the
>> composite ops. When I investigated into the topic, I thought about it, but I
>> faced with two problems I had no idea how to solve it:
>> 1) The sse instruction set does not have integer division instruction. So it
>> will have to be workarounded somehow.
>> 2) Integer multiplication instructions change the size of the operands. I
>> didn't know how to solve it properly.
> Forgive me if I say something completely out of place, but if you mean
> you get out-of-bond errors with integer multiplication, there are MMX
> operations that solve the bound problem by clipping values.

Yes, for multiplication you use a biased keep-low 16 bit unsigned 
multiplication (there is no keep high unsigned version) and subsequent 
shifts. It does not change the size of the operands (though you need to 
use 16 bit anyway).

But the division is not so easy. You either cast to float and back or 
have to implement your own division algorithm.


More information about the kimageshop mailing list