[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cross-compiler and portability issues
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 12 Aug 2008 03:15:21 -0300
> The cross-compiler that I wrote uses C99 standard integer types like
> "int32_t" and "int16_t". This makes it incompatible with ANSI C. I'm
> now thinking that I should use #ifdefs to only build the cross-
> compiler if C99 is available. Can anybody think of a better solution?
Lua 3.2 used this:
static void DumpWord(int i, FILE* D)
{
int hi= 0x0000FF & (i>>8);
int lo= 0x0000FF & i;
fputc(hi,D);
fputc(lo,D);
}
static void DumpLong(long i, FILE* D)
{
int hi= 0x00FFFF & (i>>16);
int lo= 0x00FFFF & i;
DumpWord(hi,D);
DumpWord(lo,D);
}
Of course, you'd have to output the parts in the correct order.