Click here to Skip to main content
15,884,975 members
Articles / Programming Languages / MSIL

Hardcore Microsoft .Net

Rate me:
Please Sign up or sign in to vote.
3.00/5 (20 votes)
22 Feb 2009CC (ASA 2.5)20 min read 87.3K   235   29  
What Microsoft didn't want you to know
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 2: 0: 0: 0
}
.assembly GenericPointers
{
  .permissionset reqmin
             = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
  .hash algorithm 0x00008004
  .ver 0: 1: 0: 0
}
.class public abstract auto sealed beforefieldinit PointerBuilder
{
 .method public hidebysig static int32 SizeOf<T>() cil managed
 {
  .maxstack  1
  sizeof     !!T
  ret
 }
 .method public hidebysig static !!T* AddressOf<T>(!!T& var) cil managed
 {
  .maxstack  1
  ldarg.0
  conv.i
  ret
 }
 .method public hidebysig static !!T* Convert<T>(native int ptr) cil managed
 {
  .maxstack  1
  ldarga.s   ptr
  call       instance void* [mscorlib]System.IntPtr::ToPointer()
  ret
 }
 .method public hidebysig static !!T* AddressOf<T>(!!T[] data, int32 index) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  ldelema    !!T
  ret
 }
}
.class public abstract auto sealed beforefieldinit MathEx
{

 .method public hidebysig static !!T Add<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  add
  ret
 }
 .method public hidebysig static !!T Sub<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  sub
  ret
 }
 .method public hidebysig static !!T Mul<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  mul
  ret
 }
 .method public hidebysig static !!T Div<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  div
  ret
 }
 .method public hidebysig static !!T Neg<T>(!!T a) cil managed
 {
  .maxstack 1
  ldarg.0
  neg
  ret
 }
 .method public hidebysig static !!T Rem<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  rem
  ret
 }
 .method public hidebysig static !!T Shl<T>(!!T a, int32 b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  shl
  ret
 }
 .method public hidebysig static !!T Shr<T>(!!T a, int32 b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  shr
  ret
 }


 .method public hidebysig static !!T UDiv<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  div.un
  ret
 }
 .method public hidebysig static !!T URem<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  rem.un
  ret
 }

 .method public hidebysig static !!T OAdd<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  add.ovf
  ret
 }
 .method public hidebysig static !!T OSub<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  sub.ovf
  ret
 }
 .method public hidebysig static !!T OMul<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  mul.ovf
  ret
 }

 .method public hidebysig static !!T UOAdd<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  add.ovf.un
  ret
 }
 .method public hidebysig static !!T UOSub<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  sub.ovf.un
  ret
 }
 .method public hidebysig static !!T UOMul<T>(!!T a, !!T b) cil managed
 {
  .maxstack 2
  ldarg.0
  ldarg.1
  mul.ovf.un
  ret
 }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-ShareAlike 2.5 License


Written By
Systems Engineer
Colombia Colombia
My name is Alfonso Ramos, I'm a Independend Software Developer Certified by Microsoft, In my interests are the video games, making them and of course playing them ^_^.

Comments and Discussions