Created
October 27, 2015 15:43
-
-
Save leppie/ce1b50a383c48a4662a0 to your computer and use it in GitHub Desktop.
New way of loading array data for bignums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void EmitMetadataArray(uint[] p) | |
{ | |
var size = p.Length * 4; | |
byte[] data = new byte[size]; | |
Buffer.BlockCopy(p, 0, data, 0, size); | |
var fb = this._typeGen.TypeBuilder.DefineInitializedData(Guid.NewGuid().ToString(), data, FieldAttributes.Static); | |
EmitInt(p.Length); | |
Emit(OpCodes.Newarr, typeof(uint)); | |
Emit(OpCodes.Dup); | |
Emit(OpCodes.Ldtoken, fb); | |
EmitCall(typeof(System.Runtime.CompilerServices.RuntimeHelpers).GetMethod("InitializeArray")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment