0x400000

 0x400000 : The nearest power of 2 (rounded down) when taking the max value of a signed 32 bit integer and dividing it by 256.

     ROUND_DOWN_TO_NEAREST_POWER_OF_2(  I32_MAX_VALUE / 256 ) 

Why? Working on rendering algorithm where I want to do floating point math using discrete units.
In order for this to work, I need to upscale all of my 1x1 pixel tiles into larger grids. Since I have
a grid of 256x256 "pixel sized tiles" on my "canvas user view" (cuvipix), I can get away with scaling
up each pixel by a factor of 0x400000 before I start doing my math.

I choose to use the max value of SIGNED integer rather than unsigned because everything is
eventually getting converted to 32 bit float. And since floats can go negative, trying to partition the
max value of a SIGNED int may result in TOO MUCH addressing space. We don't want to
lose precision when we convert of discrete integer fractions into floating point if we can help it.

Hmm... Now that I think of it... We will use some precision because we have less mantissa bits.
Right? Because some bits have to be used for the decimal portion.... Not sure now...
Well... My calculations might not be perfect. But at least they are not completely arbitrary.

Video #260 will be where I work on these thoughts on livestream to finish my render algorithm.
( VID_IID[ 260 ] )

www.twitch.com/kanjicoder

It will be archived here:
https://www.youtube.com/watch?v=pxeQhOcm-mc&list=PLN4rUakF78aCdRxjMU8_JBGAKIrtt_7N5


Comments

Popular posts from this blog

How to compile C without an IDE

Clean Code Sucks , Make Up New Words!