Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept byteOffset when creating an index from a buffer #55

Merged
merged 9 commits into from
Jan 20, 2024

Conversation

kylebarron
Copy link
Contributor

Closes #54

Change list

  • Allows Uint8Array input in Flatbush.from
  • Throws if Uint8Array is not 8-byte aligned. When ArrayType is not Float64, maybe the alignment requirement could be less strict.
  • Uses byteOffset when creating views on the input ArrayBuffer
  • Adds byteOffset argument to constructor.
  • Adds test that throws when alignment is incorrect and test that succeeds when alignment is correct.

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
Copy link
Owner

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits but this looks good overall!

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
test.js Outdated Show resolved Hide resolved
@mourner mourner changed the title Support Uint8Array input Accept byteOffset when creating an index from a buffer Jan 19, 2024
kylebarron and others added 5 commits January 20, 2024 13:04
Co-authored-by: Volodymyr Agafonkin <[email protected]>
Co-authored-by: Volodymyr Agafonkin <[email protected]>
Co-authored-by: Volodymyr Agafonkin <[email protected]>
Co-authored-by: Volodymyr Agafonkin <[email protected]>
Copy link
Owner

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@mourner mourner merged commit 5d079a6 into mourner:main Jan 20, 2024
1 check passed
@kylebarron kylebarron deleted the kyle/byte-offset branch January 23, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flatbush.from with Uint8Array input viewing external ArrayBuffer
2 participants