GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reduce byteLength calls for JSTypedArray · swiftwasm/JavaScriptKit@31ae862

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Sources/JavaScriptKit/BasicObjects
    • JSTypedArray.swift
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Sources/JavaScriptKit/BasicObjects/JSTypedArray.swift‎

Copy file name to clipboardExpand all lines: Sources/JavaScriptKit/BasicObjects/JSTypedArray.swift
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class JSTypedArray<Element>: JSBridgedClass, ExpressibleByArrayLiteral wh
8282
let rawBuffer = malloc(bytesLength)!
8383
defer { free(rawBuffer) }
8484
_load_typed_array(jsObject.id, rawBuffer.assumingMemoryBound(to: UInt8.self))
85-
let length = lengthInBytes / MemoryLayout<Element>.size
85+
let length = bytesLength / MemoryLayout<Element>.size
8686
let boundPtr = rawBuffer.bindMemory(to: Element.self, capacity: length)
8787
let bufferPtr = UnsafeBufferPointer<Element>(start: boundPtr, count: length)
8888
let result = try body(bufferPtr)
@@ -109,7 +109,7 @@ public class JSTypedArray<Element>: JSBridgedClass, ExpressibleByArrayLiteral wh
109109
let rawBuffer = malloc(bytesLength)!
110110
defer { free(rawBuffer) }
111111
_load_typed_array(jsObject.id, rawBuffer.assumingMemoryBound(to: UInt8.self))
112-
let length = lengthInBytes / MemoryLayout<Element>.size
112+
let length = bytesLength / MemoryLayout<Element>.size
113113
let boundPtr = rawBuffer.bindMemory(to: Element.self, capacity: length)
114114
let bufferPtr = UnsafeBufferPointer<Element>(start: boundPtr, count: length)
115115
let result = try await body(bufferPtr)

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.