r�solu.. j'ai la bonne maintenant: 

#define ALIGN(x,y) ((x +(y +1)) & ~(y - 1));

(prendre tous les cas en compte).

On Tue, Oct 29, 2002 at 12:17:29AM +0100, Thomas Silvestre wrote:
> 
> 
> Jean-Francois Dive wrote:
> >bon, j'ai un bloquage mental la donc .. si kkun peut m'expliquer:
> >
> >probleme: �crire une macro C qui renvoie une valeur de taille de structure
> >align�e sur X bytes:
> >
> >donc genre macro ALIGN(sizeof(struct machin_chose), 4) (4 �tant donc 
> >alignement sur
> >64 bits).
> >
> >si je fait donc
> >
> >#define ALIGN(x,y) (x + (x / y)) 
> >
> >je dois etre bon la non ? (mon probleme est de savoir si ca va marcher a 
> >tous les couts) (on parle de valeur non sign�e entieres, donc des uintX_t) 
> >..
> >
> >Jef
> >
> 
> il n'y a rien qui me saute aux yeux, tu as un ennui pr�cis? �a ne 
> fonctionne pas comme il faut?
> 
> -- 
>  _                      _
> ( "> Thomas Silvestre <^ )
> (v )   AEL activist   ( <)
>  ---    www.ael.be    ---
> "Si tu arrives au sommet de la montagne, continue de grimper!"
>   - Bouddha .
> 
> _______________________________________________________
> Linux Mailing List - http://www.unixtech.be
> Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
> Archives: http://www.mail-archive.com/linux@;lists.unixtech.be
> IRC: efnet.skynet.be:6667 - #unixtech

-- 

-> Jean-Francois Dive
--> [EMAIL PROTECTED]

  There is no such thing as randomness.  Only order of infinite
  complexity.  - _The Holographic Universe_, Michael Talbot

_______________________________________________________
Linux Mailing List - http://www.unixtech.be
Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux
Archives: http://www.mail-archive.com/linux@;lists.unixtech.be
IRC: efnet.skynet.be:6667 - #unixtech

Répondre à