New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

asc-wasm

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asc-wasm

Generate Wasm modules in AssemblyScript

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

asc-wasm

WebAssembly generation in AssemblyScript

The implementation has been carefully written to avoid any runtime support and allocations. All functions are inlined to make linking easier.

Usage

yarn add asc-wasm
import * as wasm from 'asc-wasm/assembly'

let ptr: u32 = 1234;

ptr += wasm.write_magic(ptr);
ptr += wasm.write_version(ptr);
...

APIs

All function return how many bytes they wrote.

  • write_section_header(ptr: u32, id: u8, size: u32): u32

Write a section header at ptr.

  • write_leb128_u32(ptr: u32, value: u32): u32

Write value as unsigned LEB128 at ptr.

  • write_signed_leb128_u32(ptr: u32, value: u32): u32

Write value as signed LEB128 at ptr but value is unsigned.

  • leb128_u32_byte_size(value: u32): u32

Calculate the encoded size of value as unsigned LEB128.

  • write_vec5<T>(ptr: u32, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T): u32

Write a Vec of constant length at ptr.

  • write_magic(ptr: u32): u32

Write WebAssembly magic number at ptr.

  • write_version(ptr: u32): u32

Write WebAssembly version at ptr.

  • write_i32_const(ptr: u32, value: u32): u32

Write a i32.const instruction with value as immediate at ptr.

  • write_end(ptr: u32): u32

Write the end instruction at ptr.

Keywords

FAQs

Package last updated on 31 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc