diff options
author | Paolo Molaro <lupus@oddwiz.org> | 2007-03-23 18:54:28 +0300 |
---|---|---|
committer | Paolo Molaro <lupus@oddwiz.org> | 2007-03-23 18:54:28 +0300 |
commit | b9968639a956492b42cb4a9847bacdb270d9e284 (patch) | |
tree | 27289e38b2e7063f7822a31a79724fa486b18509 /mcs/ilasm | |
parent | b80bd06ab23bd1a725a8ab35dfaa0be5c122fa78 (diff) |
Fri Mar 23 16:52:06 CET 2007 Paolo Molaro <lupus@ximian.com>
* ILParser.jay: fix BitConverter use on big endian archs
(this was likely the cause of Zoltan's change in r72237
which has been reverted in r74485).
svn path=/trunk/mcs/; revision=74884
Diffstat (limited to 'mcs/ilasm')
-rw-r--r-- | mcs/ilasm/parser/ChangeLog | 7 | ||||
-rw-r--r-- | mcs/ilasm/parser/ILParser.jay | 14 |
2 files changed, 19 insertions, 2 deletions
diff --git a/mcs/ilasm/parser/ChangeLog b/mcs/ilasm/parser/ChangeLog index 5059062998b..65686ac9bd9 100644 --- a/mcs/ilasm/parser/ChangeLog +++ b/mcs/ilasm/parser/ChangeLog @@ -1,3 +1,10 @@ + +Fri Mar 23 16:52:06 CET 2007 Paolo Molaro <lupus@ximian.com> + + * ILParser.jay: fix BitConverter use on big endian archs + (this was likely the cause of Zoltan's change in r72237 + which has been reverted in r74485). + 2007-01-10 Ankit Jain <jankit@novell.com> * ILParser.jay (GetTypeRef): Use BaseTypeRef.Clone diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay index 5fbdb1edf0d..ddb93c471cd 100644 --- a/mcs/ilasm/parser/ILParser.jay +++ b/mcs/ilasm/parser/ILParser.jay @@ -2428,13 +2428,23 @@ instr : INSTR_NONE }
| INSTR_R bytes_list
{
+ byte[] fpdata;
switch ((MiscInstr) $1) {
case MiscInstr.ldc_r4:
- float s = BitConverter.ToSingle ((byte []) $2, 0);
+ fpdata = (byte []) $2;
+ if (!BitConverter.IsLittleEndian) {
+ System.Array.Reverse (fpdata, 0, 4);
+ }
+ float s = BitConverter.ToSingle (fpdata, 0);
codegen.CurrentMethodDef.AddInstr (new LdcInstr ((MiscInstr) $1, s, tokenizer.Location));
break;
case MiscInstr.ldc_r8:
- double d = BitConverter.ToDouble ((byte []) $2, 0);
+ fpdata = (byte []) $2;
+ if (!BitConverter.IsLittleEndian) {
+ // FIXME: handle the stupid ARM FPA format
+ System.Array.Reverse (fpdata, 0, 8);
+ }
+ double d = BitConverter.ToDouble (fpdata, 0);
codegen.CurrentMethodDef.AddInstr (new LdcInstr ((MiscInstr) $1, d, tokenizer.Location));
break;
}
|