On 01/15/03 Serge Lidin wrote:
> One example of using an arbitrary blob is value type initialization. Take a look at 
>the following code:
> .class public value sequential MyVT
> {
>         .pack 1
>         .field public int32 a
>         .field public int64 b
>         .field public int16 c
>         .method public void Init(string Blob,int32 Offset)
>         {
>                 ldarg.0
>                 ldarg.1
>                 call instance char[] [mscorlib]System.String::ToCharArray()
>                 ldc.i4.0
>                 ldelema [mscorlib]System.Char
>                 ldarg.2
>                 add
>                 sizeof MyVT
>                 cpblk
>                 ret
>         }

This is also a good way to ensure the program won't work on big-endian
systems and, unless the structure is several hundred bytes big, it's
most certainly slower than doing the initialization with load
constant/store field.

lupus

--
-----------------------------------------------------------------
[EMAIL PROTECTED]                                     debian/rules
[EMAIL PROTECTED]                             Monkeys do it better

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to