projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use new search_vec function to find vdso in dynamic linker
[musl]
/
src
/
network
/
htonl.c
diff --git
a/src/network/htonl.c
b/src/network/htonl.c
index
b21dace
..
6622d16
100644
(file)
--- a/
src/network/htonl.c
+++ b/
src/network/htonl.c
@@
-1,10
+1,8
@@
#include <netinet/in.h>
#include <netinet/in.h>
+#include <byteswap.h>
uint32_t htonl(uint32_t n)
{
uint32_t htonl(uint32_t n)
{
- union {
- uint8_t b[4];
- uint32_t i;
- } u = { { n>>24, n>>16, n>>8, n } };
- return u.i;
+ union { int i; char c; } u = { 1 };
+ return u.c ? bswap_32(n) : n;
}
}