On Tue, Nov 18, 2025 at 12:52:47AM +0000, Timur Tabi wrote:
[...] 
> > > +
> > >          Ok(Self {
> > > -            imem_sec_load_target: FalconLoadTarget {
> > > -                src_start: app0.offset,
> > > -                dst_start: 0,
> > > -                len: app0.len,
> > > +            imem_sec_load_target: if chipset > Chipset::GA100 {
> > > +                FalconLoadTarget {
> > > +                    src_start: app0.offset,
> > > +                    dst_start: 0,
> > > +                    len: app0.len,
> > > +                }
> > > +            } else {
> > > +                FalconLoadTarget {
> > > +                    src_start: load_hdr.os_code_size,
> > > +                    dst_start: app0.offset,
> > > +                    len: app0.len,
> > > +                }
> > 
> > Can write more succinctly:
> > 
> >   imem_sec_load_target: FalconLoadTarget {
> >       src_start: match chipset > Chipset::GA100  {
> >           true => app0.offset,
> >           false => load_hdr.os_code_size,
> >       },
> >       dst_start: match chipset > Chipset::GA100 {
> >           true => 0,
> >           false => app0.offset,
> >       
> >       len: app0.len,                                                        
> >                     
> >   },
> 
> Do we really want to use "match" instead of "if", just because we don't need 
> "else"?

I don't care about the if/else as much as I care about the opportunity to
just specify FalconLoadTarget once instead twice. I think the match here is 
cleaner for this
snippet, but I am Ok with the if/else as well.

Something like:
   imem_sec_load_target: FalconLoadTarget {
       src_start: if chipset > Chipset::GA100  {
          app0.offset
      } else {
           load_hdr.os_code_size
      },

That would be one more line of code, but pretty much the same.

thanks,

 - Joel


Reply via email to