Closed
Bug 583204
Opened 15 years ago
Closed 15 years ago
return value (if sizeof < 4) is wrong on BIG ENDIAN machine
Categories
(Core :: js-ctypes, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: ginnchen+exoracle, Unassigned)
Details
The ffi usage is:
For smaller return value sizes, the ffi_arg or ffi_sarg integral type must be used to hold the return value.
so if the return value is int8_t, we should do
int8_t rv = *(ffi_arg*)result_address;
But currently we do
int8_t rv = *(int8_t*)result_address;
It doesn't matter if it is LITTLE ENDIAN.
But it is not portable to BIG ENDIAN machine, e.g. SPARC.
There're several places in ConvertToJS().
We need to do the cast if data is from ffi_call().
Maybe we can do a trick in FunctionType::Call().
Comment 1•15 years ago
|
||
What build? I fixed this on tracemonkey (not sure if it's merged to mc yet) a week ago or so.
confirm fixed on latest mozilla-central
Thanks!
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•