[Mono-dev] BitArray patch

Alan McGovern alan.mcgovern at gmail.com
Tue Mar 27 08:44:45 EDT 2007


I think the code should act the same as the original whether it's big endian
or little. The unsafe code just copies the bytes out one after another in a
row. So on a big endian system you'd get FF-00-00-00 as the first four bytes
but on a little endian you might get 00-00-00-FF.

With the old code, you'd get the same. (as far as i can make out).

Alan.

On 3/27/07, David Brown <mono at davidb.org> wrote:
>
> Alan McGovern wrote:
>
> > I was just looking at the bitarray code and i thought that instead
> > of a lot of bitshifting and messing to retrieve individual bytes
> > from int's it would be faster (and easier?) to use unsafe code and
> > mess with individual bytes that way. This patch makes it about 20%
> > faster to create a bit array from an int[].
>
> What about byte ordering, though?  The code being replaced seems to
> always extract as if the data were little endian, but the unsafe code
> will depend on the endianness of the platform we're running on.
>
> Dave
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070327/d539389c/attachment.html 


More information about the Mono-devel-list mailing list