Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>CSS詳細度テスト</title>
<style>
* {
font-size:10px;
;; 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 April 20, 2019 02:03
WASMテキストモードのプリプロセスをJSでできるようにしてみた。
;; block
{@
$.X = 0x1;
$.Y = 2;
$.Z = 0x3;
}
;; code
(module
(export "test" (func $test))
@sfpgmr
sfpgmr / .gitignore
Last active March 30, 2019 20:44
three.jsのPathのシリアライズ(2)
node_modules
@sfpgmr
sfpgmr / for.pegjs
Last active November 16, 2018 21:17
/ ForToken __
"(" & __
init:(ExpressionNoIn __ )? ";" __
test:(Expression __)? ";" __
update:(Expression __)?
")" __
body:Statement
{
@sfpgmr
sfpgmr / co-test.mjs
Created October 13, 2018 08:42
オレオレ言語のコルーチンをハンド・コンパイルしてみた。
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 August 14, 2018 09:15
メモリの検証コードを書く
(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 August 12, 2018 06:35
IEEE754 float32/64のビットパターンを持つ1つ/2つの32ビット値を元にして、32/64bit floatを返すwasm関数
(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 July 24, 2018 11:11
Open Street Mapのデータの3D化 ... 大阪環状線周囲までの表示領域拡大と、パフォーマンス改善
typings
node_modules
.vscode
@sfpgmr
sfpgmr / source
Created April 28, 2018 12:30
オレオレ言語のコンパイルテスト(6)for文
export i32 main(){
i32 a = 0;
for(i32 c = 0;c < 4;++c) {
++a;
}
return a;// 4
}