mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 22:41:27 +00:00
Clarify the use of RGBA vs ABGR in the game-of-life example
This commit is contained in:
@ -62,8 +62,8 @@ fetch("build/optimized.wasm")
|
||||
.then(response => response.arrayBuffer())
|
||||
.then(buffer => WebAssembly.instantiate(buffer, {
|
||||
env: {
|
||||
RGB_ALIVE : rgb2le(RGB_ALIVE) | 1, // little endian, LSB must be set
|
||||
RGB_DEAD : rgb2le(RGB_DEAD) & ~1, // little endian, LSB must not be set
|
||||
BGR_ALIVE : rgb2bgr(RGB_ALIVE) | 1, // little endian, LSB must be set
|
||||
BGR_DEAD : rgb2bgr(RGB_DEAD) & ~1, // little endian, LSB must not be set
|
||||
BIT_ROT,
|
||||
memory,
|
||||
abort: function() {}
|
||||
@ -125,7 +125,8 @@ fetch("build/optimized.wasm")
|
||||
console.log(err.stack);
|
||||
});
|
||||
|
||||
function rgb2le(rgb) {
|
||||
// see comment in assembly/index.ts on why this is useful
|
||||
function rgb2bgr(rgb) {
|
||||
return ((rgb >>> 16) & 0xff) | (rgb & 0xff00) | (rgb & 0xff) << 16;
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user