bytefill function question
DXC
Posts: 33
Hello all,
I want to fill an array (Rel[150]) 1-128 with a value '1' except 0.
Can this be done like below?
bytefill(@Rel+1, 1,128)
or maybe another way?
gr,
Bart
I want to fill an array (Rel[150]) 1-128 with a value '1' except 0.
Can this be done like below?
bytefill(@Rel+1, 1,128)
or maybe another way?
gr,
Bart
Comments
So @Rel+1 is the same as @Rel[1]?
gr,
Coded some in assembly and thats the same.
like rdlong function I have to ad 4 to the pointer to get the next long.
also nice to here Rel[1] is less code.
gr,
bytefill(@Rel[1], 1,127)
and not 128 as the count
Maybe you mix that up with index-count. If you define an array like
byte test[128]
your index range is from 0 to 127. But you still have 128 elements. If you want to fill that from test[1] up to the end you have to say
bytefill( @test[1], 1, 127 )
but here you only want to fill 127 bytes.
In other words the 3rd parameter is really the number of bytes you want to initialize. It has nothing to do with the index.
But it's not, tested it and as you said is has to be 128.
gr,