Pointer Array for division and multiplication

Started by Baggey, September 12, 2021, 08:20:11

Previous topic - Next topic

Baggey

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
Running a PC that just Aint fast enough!? i7 Quad core 16GB ram 1TB SSD and NVIDIA Quadro K620 . DID Technology stop! Or have we been assimulated!

ZX Spectrum 48k, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip. Im Misunderstood!

iWasAdam

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?) ;)

markcwm

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.

Baggey

Quote from: markcwm 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.

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

Baggey
Running a PC that just Aint fast enough!? i7 Quad core 16GB ram 1TB SSD and NVIDIA Quadro K620 . DID Technology stop! Or have we been assimulated!

ZX Spectrum 48k, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip. Im Misunderstood!