Swab implementation is added to libc/src/unistd.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/unistd/linux/swab.cpp | ||
---|---|---|
18 | Thanks for catching - included size check as well. |
libc/test/src/unistd/swab_test.cpp | ||
---|---|---|
15 | Since the argument type is ssize_t there should be a test that a negative size is also a no-op. | |
20 | This only tests the compiler, not the function, since it won't do anything to change what pointer to is. | |
27 | Same logic applies here. This isn't really testing anything except that it didn't crash. | |
33 | Just = {}; is equivalent here and seems more clear that it's simply zero-initializing the whole array. |
lgtm!
libc/src/unistd/linux/swab.cpp | ||
---|---|---|
19 | I don't see any reason for this short-circuit. The loop will naturally have zero iterations for these cases. |
Sorry I failed to notice the placement and build plumbing are not right here. It should not be in the linux/ subdir, it has nothing to do with linux or any other OS.
Follow the model of e.g. getopt that is in unistd but is not OS-specific.
this should be SSizeTType