chiark
/
gitweb
/
~mdw
/
tripe
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a821119
)
server/addrmap.c (hash): Visually tighten the arithmetic.
author
Mark Wooding
<mdw@distorted.org.uk>
Fri, 29 Sep 2017 09:06:13 +0000
(10:06 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Thu, 28 Jun 2018 23:29:23 +0000
(
00:29
+0100)
server/addrmap.c
patch
|
blob
|
blame
|
history
diff --git
a/server/addrmap.c
b/server/addrmap.c
index 140d0b6ea0a324e1d724a532613a6f8fdc38bcb1..6091dbfc3a779817976d28c799ac660ea94f7122 100644
(file)
--- a/
server/addrmap.c
+++ b/
server/addrmap.c
@@
-76,9
+76,9
@@
static uint32 hash(const addr *a)
{
switch (a->sa.sa_family) {
case AF_INET:
{
switch (a->sa.sa_family) {
case AF_INET:
- return (U32(
(AF_INET * 0x4eaac1b7ul)
+
-
(a->sin.sin_addr.s_addr * 0xa5dbc837)
+
-
(a->sin.sin_port * 0x3b049e83)
));
+ return (U32(
0x4eaac1b7ul*AF_INET
+
+
0xa5dbc837ul*a->sin.sin_addr.s_addr
+
+
0x3b049e83ul*a->sin.sin_port
));
default:
abort();
}
default:
abort();
}