private ILEmitter EmitHashAsSortedArray(ILEmitter il, LocalBuilder enumerable, LocalBuilder hash) { var hasCustomComparer = _configuration.HasCustomComparer(_elementType); il.EmitArraySorting(hasCustomComparer, _elementType, enumerable); var arrayType = _elementType.MakeArrayType(); return(_arrayHashEmitter.Emit(il, arrayType, enumerable, hash)); }
public ILEmitter Emit(ILEmitter il, LocalBuilder hash) { var arrayType = _variable.VariableType; il.Emit(_variable.Load(Arg.Input)) // load array .Stloc(arrayType, out var array) .Brtrue_S(Ldloc(array), out var begin) .Ldc_I4(0) .Br(out var end) .MarkLabel(begin); if (_configuration.IgnoreCollectionOrder) { il.EmitArraySorting(_hasCustomComparer, arrayType.GetElementType(), array); } return(_arrayHashEmitter.Emit(il, arrayType, array, hash).MarkLabel(end)); }