* [PATCH] xfrm: use "unsigned int" in addr_match()
@ 2017-03-23 23:07 Alexey Dobriyan
2017-03-27 10:36 ` Steffen Klassert
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2017-03-23 23:07 UTC (permalink / raw)
To: steffen.klassert; +Cc: herbert, davem, netdev
x86_64 is zero-extending arch so "unsigned int" is preferred over "int"
for address calculations and extending to size_t.
Space savings:
add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-24 (-24)
function old new delta
xfrm_state_walk 708 696 -12
xfrm_selector_match 918 906 -12
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
include/net/xfrm.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -816,12 +816,12 @@ static inline void xfrm_state_hold(struct xfrm_state *x)
}
static inline bool addr_match(const void *token1, const void *token2,
- int prefixlen)
+ unsigned int prefixlen)
{
const __be32 *a1 = token1;
const __be32 *a2 = token2;
- int pdw;
- int pbi;
+ unsigned int pdw;
+ unsigned int pbi;
pdw = prefixlen >> 5; /* num of whole u32 in prefix */
pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] xfrm: use "unsigned int" in addr_match()
2017-03-23 23:07 [PATCH] xfrm: use "unsigned int" in addr_match() Alexey Dobriyan
@ 2017-03-27 10:36 ` Steffen Klassert
0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2017-03-27 10:36 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: herbert, davem, netdev
On Fri, Mar 24, 2017 at 02:07:50AM +0300, Alexey Dobriyan wrote:
> x86_64 is zero-extending arch so "unsigned int" is preferred over "int"
> for address calculations and extending to size_t.
>
> Space savings:
>
> add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-24 (-24)
> function old new delta
> xfrm_state_walk 708 696 -12
> xfrm_selector_match 918 906 -12
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Applied to ipsec-next, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-27 10:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 23:07 [PATCH] xfrm: use "unsigned int" in addr_match() Alexey Dobriyan
2017-03-27 10:36 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).