lkml.org 
[lkml]   [1997]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: ARCH32BIT, ARCH64BIT defines
From
Date
Pavel Machek <pavel@Elf.mj.gts.cz> writes:

> Sometimes through the code (like in printk( "%08lx" );) knowing
> whether architecture is 32 or 64 bit would be nice. Yes, you can do it
> by if ((sizeof( long))==4) and hope that gcc optimizes it right, but
> this is more convient:
>
> #ifdef ARCH32BIT
> #define X "8"
> #else
> #define X "16"
> #endif

I suggest autoconf's approach to naming:

#if SIZEOF_LONG=4
#define X "8"
#elif SIZEOF_LONG=8
#define X "16"
#else
#error Fix me to deal with your long size.
#endif

--
Aaron M. Ucko <amu@mit.edu> (finger amu@monk.mit.edu) [Stark raving sane]

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.076 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site