Another endianess problem on Solaris

Jeff Sturm jsturm@one-point.com
Mon Feb 18 02:22:00 GMT 2002


On 17 Feb 2002, Tom Tromey wrote:
> I looked at writing the proposed fix tonight. It's not clear to me
> how it should work. Do we want a new function like
> ffi_promoted_type()? The idea being that we would pass in a type,
> like FFI_TYPE_UINT8, and then ffi would return the promoted type.

How would you use this function in natMethod.cc? We still need to
allocate space according to this type and cast from it.
We had discussed using a typedef. I'm testing a patch now. (I got
distracted by a unrelated failure, and makefile problems in libffi.)
> Do we have a table of the rules for all the supported platforms?

Generally all return value smaller than a pointer are promoted. MIPS N32
is the lone exception, which promotes to "long long".
There is already the SIZEOF_ARG macro which tells us the size of this
type. The raw API currently requires SIZEOF_ARG to be 4 or 8. So the
typedef can be as simple as
#if (SIZEOF_ARG != 4) && (SIZEOF_ARG != 8)
-- trouble
#endif
#if SIZEOF_ARG == 4
typedef UINT32 ffi_arg;
#endif
#if SIZEOF_ARG == 8
typedef UINT64 ffi_arg;
#endif
Jeff


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /