mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-30 12:31:53 +08:00
Update.
2003-08-27 Jakub Jelinek <jakub@redhat.com> * inet/inet_mkadr.c (inet_makeaddr): Optimize.
This commit is contained in:
parent
577822c05f
commit
f8df79dbba
@ -1,3 +1,7 @@
|
|||||||
|
2003-08-27 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* inet/inet_mkadr.c (inet_makeaddr): Optimize.
|
||||||
|
|
||||||
2003-08-27 Ulrich Drepper <drepper@redhat.com>
|
2003-08-27 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* include/stdio.h: Add declarations for __builtin_fwrite and
|
* include/stdio.h: Add declarations for __builtin_fwrite and
|
||||||
|
@ -43,17 +43,17 @@ struct in_addr
|
|||||||
inet_makeaddr(net, host)
|
inet_makeaddr(net, host)
|
||||||
in_addr_t net, host;
|
in_addr_t net, host;
|
||||||
{
|
{
|
||||||
u_int32_t addr;
|
struct in_addr in;
|
||||||
|
|
||||||
if (net < 128)
|
if (net < 128)
|
||||||
addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
|
in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
|
||||||
else if (net < 65536)
|
else if (net < 65536)
|
||||||
addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
|
in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
|
||||||
else if (net < 16777216L)
|
else if (net < 16777216L)
|
||||||
addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
|
in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
|
||||||
else
|
else
|
||||||
addr = net | host;
|
in.s_addr = net | host;
|
||||||
addr = htonl(addr);
|
in.s_addr = htonl(in.s_addr);
|
||||||
return (*(struct in_addr *)&addr);
|
return in;
|
||||||
}
|
}
|
||||||
libc_hidden_def (inet_makeaddr)
|
libc_hidden_def (inet_makeaddr)
|
||||||
|
Loading…
Reference in New Issue
Block a user