-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
AK: Implement ShortString for big-endian #24687
Conversation
I'd strongly prefer if we didn't bother with big endian. It's fringe enough that the intersection and fringe OS should be pretty close to empty. (Edit: to be clear, this is just my personal opinion, not project consensus.) |
@nico, I don't think the question of big-endian support is solely about it being fringe or not. Some projects (e.g. OpenBSD) also target big-endian platforms to discover bugs or potential security issues earlier. /2c Of course the project is free to decide whether or not they want to take my patches. |
Adding big-endian support for lagom will probably not be that complicated. I did actually try to compile serenity for big-endian RISC-V some time ago (just for fun). But that resulted in a lot of compilation errors in the kernel (mostly in the NVMe driver, which uses the endian conversion functions incorrectly). Technically aarch64 and riscv64 also have big-endian variants, but we also don't support those either. |
I'm also in favor of cherry picking big-endian patches. My main argument is not having two diverging AK implementations that will be a big pain to cherry pick patches between. As for the kernel side of things, if we ever decide to port Serenity to BE arch, I don't think it will be hard to patch Clang and/or GCC to provide |
That's an extremely fair point! The one thing I'd reply to that is that while it's fun for some, it's not necessarily fun for others, but supporting big-endian is kind of an all-or-nothing deal. For example, when you want to do a high-performance bitstream reader, you might want to make assumptions about endianness, and that's a lot easier if there's just one endianness. (It my mind, adding support for big-endian is a little like adding support for architectures where (Again, this is just my personal opinion etc)
Independent of this PR, I think this is a very bad argument, since with this argument we'll want to cherry-pick over more or less anything – except for their NIH work. And since we won't pick the NIH bits, we'll have cherry-picking pain sooner or later anyways. (In fact, we already do, due to skia-specific changes in LibWeb.) Cherry-picks will become rarer and harder over time. That's the nature of forks. I don't think we should spend a lot of energy fighting this. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! |
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions! |
This PR flips the ShortString struct order for big-endian systems.
Further, I added a test case to assert that if a ShortString is interpreted as a pointer it will be odd.
This is a copy of LadybirdBrowser/ladybird#416 and has not been tested in SerenityOS, because I don't have a system running SerenityOS.