Dead Hackers Society
Other BBSes »
 
 

Sommarhack 2024

Silly Venture 2024 SE
Demoscene  Coding  CT60  Buy/sell

Atari demoscene BBS
 
Re: 32 bit muls
Posted by: PeyloW May,18.2014-17:55 

Ok, wo what I did with the 16.16 fixed point math multiplication is to simply define it as:
fix16_t fix16_mul(fix16_t a, fix16_t a) { return int32_mul(a >> 8, b >> 8); }

This adds the cost of two shifts, and the mil can then be done with my in regs only multiplication. As far as I see I do not loose any precision, but the rounding is wrong. But who cares :).

The division is a bit trickier:
fix16_t fix16_div(fix16_t a, fix16_t a) { return int32_div(a, b >> 8) << 8; }

Works, and still only two shifts costlier than the normal 32bit divs. But 8 bits of precision is always lost... which is bad :(.









[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
32 bit muls PeyloW May,15.2014-22:51
  Re: 32 bit muls ggn May,17.2014-07:58
    Re: 32 bit muls ggn May,17.2014-08:00
    Re: 32 bit muls PeyloW May,17.2014-15:05
      Re: 32 bit muls PeyloW May,18.2014-17:55
  Re: 32 bit muls bob_er/mec May,17.2014-09:57
    Re: 32 bit muls Alien / ST-CNX May,21.2014-21:14
    Re: 32 bit muls PeyloW May,22.2014-10:52
      Re: 32 bit muls PeyloW May,23.2014-10:10
        Re: 32 bit muls dml May,23.2014-22:29


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson