diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2025-06-04 17:42:40 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2025-06-24 09:43:02 -0300 |
commit | e6ad9650fbed02f167a90cd6554a7599356317cc (patch) | |
tree | 5daccbca973be3eac04269e993b5abbb621f6d62 /benchtests/inet_ntop_ipv4-source.c | |
parent | fc6f074e0496fb8a8df491641165f4ed3cdaa3a3 (diff) | |
download | glibc-e6ad9650fbed02f167a90cd6554a7599356317cc.zip glibc-e6ad9650fbed02f167a90cd6554a7599356317cc.tar.gz glibc-e6ad9650fbed02f167a90cd6554a7599356317cc.tar.bz2 |
benchtests: Add IPv4 inet_ntop benchmark
Random IP addresses in the full range.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'benchtests/inet_ntop_ipv4-source.c')
-rw-r--r-- | benchtests/inet_ntop_ipv4-source.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/benchtests/inet_ntop_ipv4-source.c b/benchtests/inet_ntop_ipv4-source.c new file mode 100644 index 0000000..c595c47 --- /dev/null +++ b/benchtests/inet_ntop_ipv4-source.c @@ -0,0 +1,10 @@ +#include <arpa/inet.h> +#include <stdint.h> + +static void +inet_ntop_ipv4 (uint32_t addr) +{ + struct in_addr saddr = { .s_addr = addr }; + char dst[INET_ADDRSTRLEN]; + inet_ntop (AF_INET, &saddr, dst, sizeof dst); +} |