I hope someone can reveal my error in reasoning.
I’m trying to put some integers into haxe.io.bytes using setInt32.
package;
import openfl.display.Sprite;
import openfl.Lib;
import haxe.io.Bytes;
class Main extends Sprite
{
public function new()
{
super();
var bytes:Bytes = Bytes.alloc(8);
bytes.setInt32(0, -320);
bytes.setInt32(1, -100);
trace(bytes.getInt32(0),bytes.getInt32(1));
}
}
What on earth causes the following output:
Main.hx:16: -25408,-100
Edit: Nevermind!
Obviously the index isn’t simply incremented by one continuously.
So:
bytes.setInt32(0, -320);
bytes.setInt32(4, -100);
trace(bytes.getInt32(0),bytes.getInt32(4));
works as expected.