Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

DataView utilities

License

NotificationsYou must be signed in to change notification settings

hqtsm/dataview

Repository files navigation

DataView utilities

dataviewfloat16int24uint24

JSRnpmCI

Features

  • Pure TypeScript, run anywhere
  • Optimized for speed and size

Usage

Float16

import{getFloat16,setFloat16}from'@hqtsm/dataview';constdata=newUint8Array(4);constview=newDataView(data.buffer);setFloat16(view,0,Math.PI);setFloat16(view,2,Math.LN10,true);console.assert(data.join(', ')==='66, 72, 155, 64');console.assert(getFloat16(view,0)===3.140625);console.assert(getFloat16(view,2,true)===2.302734375);

Int24

import{getInt24,setInt24}from'@hqtsm/dataview';constdata=newUint8Array(6);constview=newDataView(data.buffer);setInt24(view,0,-1234);setInt24(view,3,-4567,true);console.assert(data.join(', ')==='255, 251, 46, 41, 238, 255');console.assert(getInt24(view,0)===-1234);console.assert(getInt24(view,3,true)===-4567);

Uint24

import{getUint24,setUint24}from'@hqtsm/dataview';constdata=newUint8Array(6);constview=newDataView(data.buffer);setUint24(view,0,12345678);setUint24(view,3,11223344,true);console.assert(data.join(', ')==='188, 97, 78, 48, 65, 171');console.assert(getUint24(view,0)===12345678);console.assert(getUint24(view,3,true)===11223344);

[8]ページ先頭

©2009-2025 Movatter.jp