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
4141 union nf_inet_addr *result,
4242 const union nf_inet_addr *mask)
4343 {
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
4452 result->all[0] = a1->all[0] & mask->all[0];
4553 result->all[1] = a1->all[1] & mask->all[1];
4654 result->all[2] = a1->all[2] & mask->all[2];
4755 result->all[3] = a1->all[3] & mask->all[3];
56+#endif
4857 }
4958
5059 int 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