forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perpare for more compact bit operations in JS (nim-lang#16728)
- Loading branch information
Showing
2 changed files
with
20 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
when defined(js): | ||
type | ||
ArrayBuffer* = ref object of JsRoot | ||
Float64Array* = ref object of JsRoot | ||
Uint32Array* = ref object of JsRoot | ||
|
||
func newArrayBuffer*(n: int): ArrayBuffer {.importjs: "new ArrayBuffer(#)".} | ||
func newFloat64Array*(buffer: ArrayBuffer): Float64Array {.importjs: "new Float64Array(#)".} | ||
func newUint32Array*(buffer: ArrayBuffer): Uint32Array {.importjs: "new Uint32Array(#)".} | ||
|
||
func `[]`*(arr: Uint32Array, i: int): uint32 {.importjs: "#[#]".} | ||
func `[]=`*(arr: Float64Array, i: int, v: float) {.importjs: "#[#] = #".} |