-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
make endians support JS backend #16127
Conversation
This reverts commit 65c8ee6.
First make |
proc bigEndian64*(outp, inp: pointer) {.inline.} = swapEndian64(outp, inp) | ||
proc bigEndian32*(outp, inp: pointer) {.inline.} = swapEndian32(outp, inp) | ||
proc bigEndian16*(outp, inp: pointer) {.inline.} = swapEndian16(outp, inp) | ||
elif defined(js): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this entire almost-duplicated block by making copyMem(outp, inp, k)
work for js, so that there's no need to have elif defined(js):
?
=>
when useBuiltinSwap or defined(js):
...
@@ -11,39 +11,55 @@ | |||
## (`endian`:idx:). | |||
## | |||
## Unstable API. | |||
when not defined(js): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove 1 level of indentation:
when defined js:
...
elif when defined(gcc) or defined(llvm_gcc) or defined(clang):
...
elif ...
This PR is not correct(handling pointer wrongly), close it. |
not true, little vs big endian, even on js, depends on architecture where code runs; but admittedly little endian will be much more common. refs timotheecour#515 |
I want to make
oids
module support JS backend. But it relies onendians
module. Of course in JS/browser, it is always big endianess in Nim.And
nodejs
backend does need endianess I think which is wrong now.This PR will solve targetCPU nad targetOS:
https://github.com/nim-lang/Nim/pull/14543/files#diff-5bfae5b518d4ab360a8cd26e9d7fdfef1d24dbf9f9922c6f77d8660a23792f51R121
Or I need this to make
oids
support JS/browser backend