Author: lupus
Date: 2007-03-23 10:54:28 -0500 (Fri, 23 Mar 2007)
New Revision: 74884

Modified:
   trunk/mcs/ilasm/parser/ChangeLog
   trunk/mcs/ilasm/parser/ILParser.jay
Log:


Fri Mar 23 16:52:06 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>

        * 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).



Modified: trunk/mcs/ilasm/parser/ChangeLog
===================================================================
--- trunk/mcs/ilasm/parser/ChangeLog    2007-03-23 15:54:20 UTC (rev 74883)
+++ trunk/mcs/ilasm/parser/ChangeLog    2007-03-23 15:54:28 UTC (rev 74884)
@@ -1,3 +1,10 @@
+
+Fri Mar 23 16:52:06 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * 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  <[EMAIL PROTECTED]>
 
        * ILParser.jay (GetTypeRef): Use BaseTypeRef.Clone

Modified: trunk/mcs/ilasm/parser/ILParser.jay
===================================================================
--- trunk/mcs/ilasm/parser/ILParser.jay 2007-03-23 15:54:20 UTC (rev 74883)
+++ trunk/mcs/ilasm/parser/ILParser.jay 2007-03-23 15:54:28 UTC (rev 74884)
@@ -2428,13 +2428,23 @@
                           }
                        | 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;
                                 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to