September 18, 2021, 04:51:43

Author Topic: Pointer Array for division and multiplication  (Read 196 times)

Offline Baggey

  • Full Member
  • ***
  • Posts: 174
Pointer Array for division and multiplication
« on: September 12, 2021, 08:20:11 »
Hi,

Im wondering what the benifits of creating an Array with a pointer TABLE, opposed to doing the math on the fly.

Ie in my project im using SHORTS. the most common sum im doing is multiplying or dividing by 256 for the MSB of the Word.

What do most people do?

1. Do the math on the fly

2. ( ( shl or shr ) by 8 ) for *256 or Divide

3. Create an Arrayed pointer to lock up the ( Division or Multiplication )

or anyother ways that i cant think off right now.

I looking for the quickest way of doing the Division or Multiplication on the Fly.

Kind Regards Baggey
Currently Running a PC that just Aint fast enough!?
ZX Spectrum 48k, NEXT, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip.

Jesus was only famous because of his DAD.

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2441
Re: Pointer Array for division and multiplication
« Reply #1 on: September 12, 2021, 08:39:41 »
bitwise shr / shl will always be the fastest

but do some checks to see too - then use the fastest (the compiler might use some strange calls that are faster?) ;)

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 499
Re: Pointer Array for division and multiplication
« Reply #2 on: September 12, 2021, 15:14:52 »
Today since computer processors are so fast, any speed increase from bit shifts will be so tiny as it won't matter. The real slowdown issue will be the way you handle your graphics.

Offline Baggey

  • Full Member
  • ***
  • Posts: 174
Re: Pointer Array for division and multiplication
« Reply #3 on: September 12, 2021, 17:08:45 »
Today since computer processors are so fast, any speed increase from bit shifts will be so tiny as it won't matter. The real slowdown issue will be the way you handle your graphics.

The fastest way for that is "GLMax2DDriver" with BlitzMax  ::)

Baggey
Currently Running a PC that just Aint fast enough!?
ZX Spectrum 48k, NEXT, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip.

Jesus was only famous because of his DAD.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal