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

Ensure endianness #22

Open
emilbayes opened this issue May 5, 2020 · 1 comment
Open

Ensure endianness #22

emilbayes opened this issue May 5, 2020 · 1 comment

Comments

@emilbayes
Copy link
Member

TypedArrays use native endianness but a lot of algorithms here assume a specific endianness. We need to find a efficient way to switch between them. Checking endianness is as simple as:

var write = new Uint16Array([0xffdd])
var check = new Uint8Array(write.buffer)[0] === 0xff ? 'big' : 'little'
@mafintosh
Copy link
Member

I wrote this https://github.com/mafintosh/convert-endianness to easily deal with these situations

Just noting that we should heavily optimise for cases with LE, as very few systems have BE

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

No branches or pull requests

2 participants