about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2020-08-05 10:29:38 +0000
committerLzu Tao <taolzu@gmail.com>2020-08-10 00:50:26 +0000
commit0210fd3d7303a626f6e821bde8fdfea056cc043b (patch)
treee59a3a06fcc6579a9cf7bdb5178587eb6a8eb21b /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parentf5fef3c715f69bbc5ab2f9e18b9e79308f1e33ae (diff)
downloadrust-0210fd3d7303a626f6e821bde8fdfea056cc043b.tar.gz
rust-0210fd3d7303a626f6e821bde8fdfea056cc043b.zip
Transmute between big endian `s6_addr` and `[u16; 8]`.
The old code already made the assumption to reinterpret
`Ipv6Addr` as `[u16; 8]`.

Glibc, Linux, FreeBSD, Win32 all makes this assumption.
The main motivation of using union it to better optimize code.

ref:
* https://docs.microsoft.com/en-us/windows/win32/api/in6addr/ns-in6addr-in6_addr
* https://github.com/freebsd/freebsd/blob/1d6e4247415d264485ee94b59fdbc12e0c566fd0/contrib/ntp/lib/isc/include/isc/ipv6.h#L63
* https://github.com/zephyrproject-rtos/zephyr/blob/8b531aa996bba254c03129658490af59597acd78/include/net/net_ip.h#L137
* https://sourceware.org/git/?p=glibc.git;a=blob;f=inet/netinet/in.h;h=f6355c7efe5192b88337b136ef687fe9a5ed648c;hb=HEAD#l216

Co-authored-by: Josh Stone <cuviper@gmail.com>
Co-authored-by: Peter Atashian <retep998@gmail.com>
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions