Array question

BlitzMax Forums/BlitzMax Beginners Area/Array question

JBR(Posted 2015) [#1]
Hi, I have an array

Global A_MyArray:Byte[ 1024*1024 ]

The array is cleared every frame.

I'm sure it is quicker to write an int 4 times less than byte.

How do I access the array with ints

I'm sure you have to use Int Ptr but can't get it to work?

Jim


JBR(Posted 2015) [#2]
Local jim:int ptr = Int Ptr( Byte Ptr( A_MyArray ) )

jim[] = int values

Is this right?


H&K(Posted 2015) [#3]
Just a quick question. (I guess if you make an int array straight after you can just minus array index, but Im not sure)

Why is it cleared every frame?
That is, is it cleared then written to? In which case dont clear

new plan, Get the pointer to start, then int poke 4096 times


grable(Posted 2015) [#4]
For large arrays its probably faster to just call MemClear (or memset for C diehards).


JBR(Posted 2015) [#5]
thanks