lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 26/94] Maple Tree: Add new data structure
Date
* Peter Zijlstra <peterz@infradead.org> [210514 11:37]:
> On Fri, May 14, 2021 at 05:32:15PM +0200, Peter Zijlstra wrote:
> > On Wed, Apr 28, 2021 at 03:36:02PM +0000, Liam Howlett wrote:
> > > +static inline unsigned long mte_pivot(const struct maple_enode *mn,
> > > + unsigned char piv)
> > > +{
> > > + struct maple_node *node = mte_to_node(mn);
> > > +
> > > + switch (mte_node_type(mn)) {
> > > + case maple_arange_64:
> > > + return node->ma64.pivot[piv];
> > > + case maple_range_64:
> > > + case maple_leaf_64:
> > > + return node->mr64.pivot[piv];
> > > + case maple_dense:
> > > + default:
> > > + return 0;
> > > + }
> > > +}
>
> Why is @piv 'unsigned char' ? Does that actually generate better code on
> any architecture?

unsigned char is to match ma_state struct offset which is kept small
for cache efficiency.

>
> At the same time; there's no bounds check.
>

I will add an assert. Thanks.

\
 
 \ /
  Last update: 2021-05-14 23:58    [W:0.131 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site