Florian Klaempfl schreef: > Koenraad Lelong schrieb: >> Hi, >> I successfully ran some MSE-gui test-programs on my arm-board. To do >> this I used a patched fpc 2.2.0-fixes. >> The patch involved backporting a fix from fpc-2.3.1 for >> TBinaryObjectReader : the arm processor has no (AFAIK) extended type. I > > Which revision is this? > If you mean 2.2.1 : readme.rev says 8445 for fpc/branches/fixes_2_2 If you mean 2.3.1 : svn info fpc says Revision : 9843
>> needed 2.2.1 because 2.3.1 breaks MSE-gui. .... > > The reader/writer stuff has to take care of this. It applies if the fpu > type is fpa,fpa10 or fp11. You can simply use the define > FPC_DOUBLE_HILO_SWAPPED to detect this. The reason for this is that the How would I do that ? I tried, see enclosed diff, with no solution. Regards, Koenraad lelong.
16a17,63 > {$IFNDEF FPC_HAS_TYPE_EXTENDED} > {$DEFINE FPC_DOUBLE_HILO_SWAPPED} > function ExtendedToDouble(e : pointer) : double; > var mant : qword; > exp : smallint; > sign : boolean; > d : qword; > begin > move(pbyte(e)[0],mant,8); //mantissa : bytes 0..7 > move(pbyte(e)[8],exp,2); //exponent and sign: bytes 8..9 > mant:=LEtoN(mant); > exp:=LEtoN(word(exp)); > sign:=(exp and $8000)<>0; > if sign then exp:=exp and $7FFF; > case exp of > 0 : mant:=0; //if denormalized, value is too small for double, > //so it's always zero > $7FFF : exp:=2047 //either infinity or NaN > else > begin > dec(exp,16383-1023); > if (exp>=-51) and (exp<=0) then //can be denormalized > begin > mant:=mant shr (-exp); > exp:=0; > end > else > if (exp<-51) or (exp>2046) then //exponent too large. > begin > Result:=0; > exit; > end > else //normalized value > mant:=mant shl 1; //hide most significant bit > end; > end; > d:=word(exp); > d:=d shl 52; > > mant:=mant shr 12; > d:=d or mant; > if sign then d:=d or $8000000000000000; > Result:=pdouble(@d)^; > end; > {$ENDIF} > > 110,111c157,166 < begin < Read(Result, SizeOf(Extended)) --- > {$IFNDEF FPC_HAS_TYPE_EXTENDED} > var ext : array[0..9] of byte; > {$ENDIF} > begin > {$IFNDEF FPC_HAS_TYPE_EXTENDED} > Read(ext[0],10); > Result:=ExtendedToDouble(@(ext[0])); > {$ELSE} > Read(Result,sizeof(Result)); > {$ENDIF} 1023d1077 <
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal