Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refactor(vector-pools): update AttribPool imports
- replace malloc's wrap() w/ typedArray()
  • Loading branch information
postspectacular committed Nov 8, 2019
1 parent 526d68c commit 88c952d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/vector-pools/src/attrib-pool.ts
Expand Up @@ -4,11 +4,12 @@ import {
IRelease,
SIZEOF,
TypedArray,
typedArray,
TYPEDARRAY_CTORS
} from "@thi.ng/api";
import { align, Pow2 } from "@thi.ng/binary";
import { isNumber } from "@thi.ng/checks";
import { MemPool, wrap } from "@thi.ng/malloc";
import { MemPool } from "@thi.ng/malloc";
import { range } from "@thi.ng/transducers";
import { ReadonlyVec, Vec, zeroes } from "@thi.ng/vectors";
import { AttribPoolOpts, AttribSpec, LOGGER } from "./api";
Expand Down Expand Up @@ -205,7 +206,7 @@ export class AttribPool implements IRelease {
assert(newAddr > 0, `out of memory`);
for (let id in this.specs) {
const a = this.specs[id];
const buf = wrap(
const buf = typedArray(
asNativeType(a.type),
this.pool.buf,
newAddr + (a.byteOffset || 0),
Expand Down Expand Up @@ -273,7 +274,7 @@ export class AttribPool implements IRelease {
) {
for (let id in specs) {
const a = specs[id];
this.attribs[id] = wrap(
this.attribs[id] = typedArray(
asNativeType(a.type),
this.pool.buf,
this.addr + (a.byteOffset || 0),
Expand Down Expand Up @@ -366,7 +367,7 @@ const resizeAttribs = (
const type = asNativeType(a.type);
const dStride = stride / SIZEOF[type];
newAttribs[id] = [
wrap(type, buf, dest + a.byteOffset, num * dStride + a.size),
typedArray(type, buf, dest + a.byteOffset, num * dStride + a.size),
dStride
];
}
Expand Down

0 comments on commit 88c952d

Please sign in to comment.