[Mono-bugs] [Bug 434514] New: Error in Write/Read encoded integer

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 10 17:51:38 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=434514


           Summary: Error in Write/Read encoded integer
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Cecil
        AssignedTo: jbevain at novell.com
        ReportedBy: high6 at live.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


You have

                public static int WriteCompressedInteger (BinaryWriter writer,
int value)
                {
                        if (value < 0x80)
                                writer.Write ((byte) value);
                        else if (value < 0x4000) {
                                writer.Write ((byte) (0x80 | (value >> 8)));
                                writer.Write ((byte) (value & 0xff));
                        } else {
                                writer.Write ((byte) ((value >> 24) | 0xc0));
                                writer.Write ((byte) ((value >> 16) & 0xff));
                                writer.Write ((byte) ((value >> 8) & 0xff));
                                writer.Write ((byte) (value & 0xff));
                        }
                        return (int) writer.BaseStream.Position;
                }

but this isn't correct, I don't know what the correct function is but I
compared this function writing 0x181 and microsoft C# 2005 and they wrote them
differently.

your func = 0x8101
microsoft = 0x8301
BinaryWriter.Write7BitEncodedInt = 0x8103

the regular 7 bit encoder seems to be it but it reads it backwards or
something.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list