UNPKG

@doc.e.dub/csound-browser

Version:

[![npm (scoped with tag)](https://shields.shivering-isles.com/npm/v/@csound/browser/latest)](https://www.npmjs.com/package/@csound/browser) [![GitHub Workflow Status](https://shields.shivering-isles.com/github/workflow/status/csound/csound/csound_wasm)](h

14 lines (12 loc) 332 B
export const sizeOfPrimitive = { int: 4, MYFLT: 4, char: 1, }; export const sizeofStruct = (jsStruct) => { const result = jsStruct.reduce((total, [_, primitive, ...rest]) => { return (total += primitive === "char" ? sizeOfPrimitive[primitive] * rest[0] : sizeOfPrimitive[primitive]); }, 0); return result; };