Skip to content

Instantly share code, notes, and snippets.

SFPGMR sfpgmr

Block or report user

Report or block sfpgmr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.wat
;; JSの16進数字列からi64値に変換する
(func $hexArrayToi64
;; 引数
(param $length i32)(param $outoffset i32)(param $sign i32)
;; 戻り値
(result i32)
;; ローカル変数
(local $offset i32) (local $l i32) (local $temp i64)
(local.set $l (i32.shl (local.get $length) (i32.const 1)))
@sfpgmr
sfpgmr / test.mwat
Last active Apr 20, 2019
WASMテキストモードのプリプロセスをJSでできるようにしてみた。
View test.mwat
;; block
{@
$.X = 0x1;
$.Y = 2;
$.Z = 0x3;
}
;; code
(module
(export "test" (func $test))
@sfpgmr
sfpgmr / .gitignore
Last active Mar 30, 2019
three.jsのPathのシリアライズ(2)
View .gitignore
node_modules
View for.pegjs
/ ForToken __
"(" & __
init:(ExpressionNoIn __ )? ";" __
test:(Expression __)? ";" __
update:(Expression __)?
")" __
body:Statement
{
@sfpgmr
sfpgmr / co-test.mjs
Created Oct 13, 2018
オレオレ言語のコルーチンをハンド・コンパイルしてみた。
View co-test.mjs
import binaryen_ from '../binaryen-wasm';
import fs from 'fs';
export function getInstance(obj,imports = {}) {
const bin = new WebAssembly.Module(obj);
const inst = new WebAssembly.Instance(bin, imports);
return inst;
}
(async ()=>{
@sfpgmr
sfpgmr / .wat
Created Aug 14, 2018
メモリの検証コードを書く
View .wat
(module
(export "test" $test)
(memory $memory 1)
(export "memory" (memory $memory))
(func $test
(drop(grow_memory (i32.const 3)));;3ページ分確保
(i32.store
(i32.const 0)
(i32.mul (current_memory) (i32.const 65536));;現在のページ数にサイズ(65536bytes)をかけた数をオフセット0に格納
)
@sfpgmr
sfpgmr / itof.wat
Created Aug 12, 2018
IEEE754 float32/64のビットパターンを持つ1つ/2つの32ビット値を元にして、32/64bit floatを返すwasm関数
View itof.wat
(module
(export "i32tof32" $i32tof32)
(export "i64tof64" $i64tof64)
;; IEE754 float32のビットパターンを持つ32ビット整数値をf32に変換する
(func $i32tof32 (param $i i32) (param $minus i32) (result f32)
(f32.reinterpret/i32
(i32.xor
(get_local $i)
(get_local $minus)
)
@sfpgmr
sfpgmr / .gitignore
Last active Jul 24, 2018
Open Street Mapのデータの3D化 ... 大阪環状線周囲までの表示領域拡大と、パフォーマンス改善
View .gitignore
typings
node_modules
.vscode
@sfpgmr
sfpgmr / source
Created Apr 28, 2018
オレオレ言語のコンパイルテスト(6)for文
View source
export i32 main(){
i32 a = 0;
for(i32 c = 0;c < 4;++c) {
++a;
}
return a;// 4
}
@sfpgmr
sfpgmr / source
Created Apr 25, 2018
オレオレ言語のコンパイルテスト(5)while / break 文
View source
i32 𩸽(i32 a,i32 b){
return a * b;
}
export i32 main(){
i32 c = 1,a = 1,b = 0;
if(c != 2){
c = 2;
a += c;
You can’t perform that action at this time.