| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/de/docs/WebAssembly/Reference/Numeric/const | [Back] [Original] |
Get to know MDN better
Dieser Inhalt wurde automatisch aus dem Englischen bersetzt, und kann Fehler enthalten. Erfahre mehr ber dieses Experiment.
Die const numerische Anweisung wird verwendet, um Zahlen zu deklarieren.
(module
(import "console" "log" (func $log (param i32)))
(func $main
i32.const 10 ;; load a number onto the stack
call $log ;; log the number
)
(start $main)
)
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url), { console });
value_type.const
value_typeDer Typ des Werts, auf dem die Anweisung ausgefhrt wird. Die folgenden Typen untersttzen const:
i32i64f32f64v128constDie const-Anweisung. Muss immer nach dem value_type und einem Punkt (.) enthalten sein.
[] -> [output]
outputDer Wert, der auf den Stapel geschoben wird:
| Anweisung | Binrformat | Beispieltext => Binr |
|---|---|---|
i32.const |
0x41 i:leb128 |
i32.const 2 => 0x41 0x02 |
i64.const |
0x42 i:leb128 |
i64.const 1 => 0x42 0x01 |
f32.const |
0x43 f:float32 |
f32.const 2.5 => 0x43 0x00 0x00 0x20 0x40 |
f64.const |
0x44 f:float64 |
f64.const 2.5 => 0x44 0x00 0x00 0x00 0x00 0x00 0x00 0x04 0x40 |
v128.const |
0xfd 0x0c (b:byte) |
v128.const i32x4 0x9 0xa 0xb 0xc => 0xfd 0x0c 0x09 0x00 0x00 0x00 0x0a 0x00 0x00 0x00 0x0b 0x00 0x00 0x00 0x0c 0x00 0x00 0x00 |
| Spezifikation |
|---|
| WebAssembly Core Specification # numeric-instructions%E2%91%A8 |
Der Bauplan fr ein besseres Internet.
Teile dieses Inhalts sind 19982026 von einzelnen mozilla.org-Mitwirkenden. Inhalte sind verfgbar unter einer Creative-Commons-Lizenz.
| Web Proxy Viewer | New URL | Original Page |