royyan@rd:~/notes$
$ cat C-23-in-a-Blog-Post-a-198-Byte-WebAssembly-Q15-Converter.md
---
date: 2026-10-12
tags: []
---

C++23 in a Blog Post: a 198-Byte WebAssembly Q15 Converter

Type a number between -1 and 1. The conversion below runs C++23 compiled to WebAssembly, right in this page.

loading…

The C++

TODO: walk through _demos/2026-10-cpp23-wasm-q15/q15.cpp: constexpr conversion, saturation, static_assert tests that run at compile time.

The build

clang++ -std=c++23 --target=wasm32 -O2 -ffreestanding -nostdlib \
    -Wl,--no-entry -Wl,--strip-all -o q15.wasm q15.cpp

No Emscripten, no runtime, no imports: stock LLVM ships the wasm32 backend and wasm-ld.

Loading it

TODO: WebAssembly.instantiateStreaming + calling exports, scalars only, no memory sharing yet.

$