[Mono-dev] Removing unsafe code in BitConverter and speedups

Robert Jordan robertj at gmx.net
Mon May 12 12:12:50 EDT 2008


Avery Pennarun wrote:
> On 5/10/08, Alan McGovern <alan.mcgovern at gmail.com> wrote:
>>  1) Removed all unsafe code, everything is managed now

> Is #1 really an advantage in the core library?  Perhaps I've missed
> some documentation here.  It seems like these sorts of small, fast
> functions are exactly what would benefit from being written in native
> code, much like key C functions are optimized in assembly.

The managed to unmanaged transition is too costly.

> Side question: is there a sort of BitConverter that *always* returns
> big-endian or little-endian, as requested?  dbus-sharp (at least the
> version I'm looking at) resorts to unsafe code to do this, which is
> pretty gross.  I see System.Net.IPAddress has methods like
> HostToNetworkOrder() which will guarantee big endianness, but you
> can't guarantee little endianness that way.

There is one written by Miguel:

http://www.mono-project.com/Mono_DataConvert

Robert



More information about the Mono-devel-list mailing list