History

netfilter: slightly optimize nf_inet_addr_mask

using 64bit computation to slightly optimize nf_inet_addr_mask

Li RongQing committed 7 years ago

Commit 522e4071 parent eabb4781 file · +9 −0Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/netfilter.h+9−0
@@ -41,10 +41,19 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1, · 40 unmodified lines
41 union nf_inet_addr *result,41 union nf_inet_addr *result,
42 const union nf_inet_addr *mask)42 const union nf_inet_addr *mask)
43{43{
44#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
45 const unsigned long *ua = (const unsigned long *)a1;
46 unsigned long *ur = (unsigned long *)result;
47 const unsigned long *um = (const unsigned long *)mask;
48
49 ur[0] = ua[0] & um[0];
50 ur[1] = ua[1] & um[1];
51#else
44 result->all[0] = a1->all[0] & mask->all[0];52 result->all[0] = a1->all[0] & mask->all[0];
45 result->all[1] = a1->all[1] & mask->all[1];53 result->all[1] = a1->all[1] & mask->all[1];
46 result->all[2] = a1->all[2] & mask->all[2];54 result->all[2] = a1->all[2] & mask->all[2];
47 result->all[3] = a1->all[3] & mask->all[3];55 result->all[3] = a1->all[3] & mask->all[3];
56#endif
48}57}
49 58
50int netfilter_init(void);59int netfilter_init(void);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t