Luca, le mar. 04 oct. 2022 22:39:03 +0200, a ecrit:
> Il 30/08/22 07:57, Luca ha scritto:
> > Il 28/08/22 15:13, Samuel Thibault ha scritto:
> > > > +                  size_t n = size / 8;
> > > > +                  saddr += n*number;
> > > > +                  usize += n*number;
> > > > +                  align_inline(saddr, 4);
> > > > +                  align_inline(usize, 4);
> > > 
> > > This should be alignof(some_align_type)
> > 
> > 
> > Will do.
> 
> Thinking about it, I'm not sure about alignof(). For example, if I add
> something like
> 
> #define MACH_MSG_ALIGNMENT alignof(rpc_vm_offset_t)
> 
> then I'm assuming that the alignment of a data type with a given size is the
> same on 32-bit and 64-bit variants. While this is true on x86 up to 4-byte
> size, it's not true for 8-byte size. Specifically, on 32-bit this would be

Mmm, good point.

> For me it would be less confusing to just define it as 4.

Ok, but in a macro, please :)
So it's not spread along the code, but in a place that will be easy to
fix for various architectures.

Samuel

Reply via email to