poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SUGGESTION] Pretty-printing custom unit types


From: apache2
Subject: Re: [SUGGESTION] Pretty-printing custom unit types
Date: Tue, 12 Jul 2022 11:06:57 +0200
User-agent: Mutt/1.9.3 (2018-01-21)

On Mon, Jul 11, 2022 at 10:46:38PM +0200, Jose E. Marchesi wrote:
> 
> PVM offset values are boxed values with:
> 
>   struct pvm_off
>   {
>     pvm_val base_type;
>     pvm_val magnitude;
>     pvm_val unit;
>   };
> 
> but then we would need to explicitly tag the PVM offset values with the
> type, like we do for arrays and structs:
> 
>     struct pvm_off
>     {
>       pvm_val type;
>       pvm_val magnitude;
>     };
> 
> Note how this may actually result on less storage used, since many PVM
> offsets will now share an explicit type value with the unit and
> base_type.
> 

Hmm. But it seems like with the first layout you'd be able to compute the
actual value with:

  __builtin_mul_overflow(pvm_off->magnitude, pvm_off->unit, &bits);

With the second proposed layout, you'd need another pointer dereference:
  __builtin_mul_overflow(pvm_off->magnitude, pvm_off->type->unit, &bits);

It's nice to save storage, but it looks to me like the pointer chasing
 would have a bigger impact on performance than the extra word in the
 immediate struct pvm_off ? I guess we can try it and measure it. :-)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]