cs8900a for big endian targets

Jonathan Larmour jifl@eCosCentric.com
Mon Mar 3 23:35:00 GMT 2003


Bob Koninckx wrote:
> Jifl,
> 
> I thought of that myself also, but, doesn't that introduce the risk
> of swapping everything at runtime rather than at compile time ? An
> additional problem would be the following

The compiler will fold constants at compilation time, so you don't have to 
worry.

> If you define e.g.
> 
> #define ISQ_RxEvent     CYG_CPU_TO_LE16(0x0004)
> 
> how do you then deal with code like ...
> 
> switch(x) {
>  ...
> 
>  case ISQ_RxEvent:    <<-- you get a compiler error here since it
>                            no longer expands to an integer
>                            expression
> }

Ah, that one would be a problem.

You'd have to do switch (CYG_CPU_TO_LE16(x)) and leave the case unadorned 
in that special case.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine



More information about the Ecos-patches mailing list