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

[malloc][RFC/Discussion] Handle endianness / Add endianness flag #196

Open
Bnaya opened this issue Jan 12, 2020 · 2 comments
Open

[malloc][RFC/Discussion] Handle endianness / Add endianness flag #196

Bnaya opened this issue Jan 12, 2020 · 2 comments

Comments

@Bnaya
Copy link
Contributor

Bnaya commented Jan 12, 2020

following discussion on discord,
https://discordapp.com/channels/445761008837984256/445761258696736790/657739072470646794

TypedArray endianness is platform specific

Malloc supports loading external arraybuffers, that possibly was created & used on a device with different endianness.
For example: passing arraybuffer as binary data from server to client.

None Goal:
Fix the whole endianness issue for userspace values.

Possible things to do about it:

  • Nothing: almost everything is LE

  • Add a header flag, that is readable in an endianness-agnostic way to tell on which endianness the pool's arraybuffer was created on. so we can make sanity check and bail.

  • Add static function on the lib to sniff the endianness on a given arraybuffer, to use before passing to a new instance of pool

  • let malloc sniff it when providing existing arraybuffer and fail/transform the arraybuffer to the appropriate endianness.

@postspectacular
Copy link
Member

@Bnaya haven't done anything specific on this yet, but just wanted to record a mental note here that the thi.ng/binary package now includes a IS_LE constant which will be true if the runtime env is little endian...

@Bnaya
Copy link
Contributor Author

Bnaya commented Feb 10, 2020

Cool!

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