[sane-devel] 3 minor problems with current (20061202) CVS code on
OS/2
Gerhard Jaeger
gerhard at gjaeger.de
Tue Dec 5 08:44:32 CET 2006
On Monday 04 December 2006 21:59, Alessandro Zummo wrote:
> On Mon, 4 Dec 2006 19:28:43 +0100 (MET)
> Gerhard Jaeger <gerhard at gjaeger.de> wrote:
>
> > > >
> > > > __le16_to_cpup(), __u16,, __le32_to_cpup(),
> > > > __u32, __le32 or __cpu_to_le32()
> > > >
> > > > are defined on OS/2. What do you suggest?
> > >
> > > mmm.. you should try to find similar macros we
> > > can use/adapt in some OS/2 include file... I guess
> > > endianness conversion is performed even on OS/2 ;)
> > >
> > Hmmm, I think you should not use these macros in userspace anyway!
> > They are not portable an I'm pretty sure building SANE on any
> > platform but Linux will fail.
>
> mm. right. So I need to find some portable macros or include
> appropriate one in sane.
>
> any suggestion?
Well, __u16 and __u32 are not necessary anyway ;)
Before finding somw suitable macros, you should also think about
handling such stuff on other platforms like PPC, where you won't
need the swapping stuff. Maybe some kind of online-detection
is necessary.
As there are only two places, where swapping is needed, you should
provide your own functions.
Gerhard
BTW: In the Plustek backend, I use this macro
#define _SWAP(x,y) { (x)^=(y); (x)^=((y)^=(x));}
with a run-time detection.
More information about the sane-devel
mailing list