lkml.org 
[lkml]   [2001]   [Jan]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: test13-pre5
Date
Followup to:  <Pine.LNX.4.10.10012301422310.581-100000@cassiopeia.home>
By author: Geert Uytterhoeven <geert@linux-m68k.org>
In newsgroup: linux.dev.kernel
>
> What about defining new types for this? Like e.g. `x8', being `u8' on platforms
> were that's OK, and `u32' on platforms where that's more efficient?
>

You may just want to look at how C99 handles this using <stdint.h>;
stdint.h defines types of the following format:

int, uint ... signed/unsigned

<size> ... exact size
_least<size> ... no smaller than
_fast<size> ... no smaller than, and efficient

_t

E.g. uint32_t, int_least64_t, uint_fast8_t (the latter could easily be
a 32-bit type, for eaxmple.)

In addition, constructor macros are defined, as well as (u)intmax_t
and (u)intptr_t; which are defined as the largest
possible integer and an integer large enough to hold a (void *),
respectively.

In other words:

(void *)(uintptr_t)(void *)foo == (void *)foo

-hpa

--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.183 / U:6.688 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site