mirror of https://github.com/icsharpcode/ILSpy.git
9 changed files with 0 additions and 271 deletions
@ -1,31 +0,0 @@
@@ -1,31 +0,0 @@
|
||||
#region Using directives
|
||||
|
||||
using System.Reflection; |
||||
using System.Runtime.CompilerServices; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
#endregion
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("QuickSort")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyProduct("QuickSort")] |
||||
[assembly: AssemblyCopyright("")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)] |
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all the values or you can use the default the Revision and
|
||||
// Build Numbers by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.*")] |
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
static class QuickSortProgram |
||||
{ |
||||
public static void Main(string[] args) |
||||
{ |
||||
int[] intArray = new int[args.Length]; |
||||
for (int i = 0; i < intArray.Length; i++) { |
||||
intArray[i] = int.Parse(args[i]); |
||||
} |
||||
QuickSort(intArray, 0, intArray.Length - 1); |
||||
for (int i = 0; i < intArray.Length; i++) { |
||||
System.Console.Write(intArray[i].ToString() + " "); |
||||
} |
||||
} |
||||
|
||||
/// For description of this algorithm see:
|
||||
/// http://en.wikipedia.org/wiki/Quick_sort
|
||||
public static void QuickSort(int[] array, int left, int right) |
||||
{ |
||||
if (right > left) { |
||||
int pivotIndex = (left + right) / 2; |
||||
int pivotNew = Partition(array, left, right, pivotIndex); |
||||
QuickSort(array, left, pivotNew - 1); |
||||
QuickSort(array, pivotNew + 1, right); |
||||
} |
||||
} |
||||
|
||||
static int Partition(int[] array, int left, int right, |
||||
int pivotIndex) |
||||
{ |
||||
int pivotValue = array[pivotIndex]; |
||||
Swap(array, pivotIndex, right); |
||||
int storeIndex = left; |
||||
for(int i = left; i < right; i++) { |
||||
if (array[i] <= pivotValue) { |
||||
Swap(array, storeIndex, i); |
||||
storeIndex = storeIndex + 1; |
||||
} |
||||
} |
||||
Swap(array, right, storeIndex); |
||||
return storeIndex; |
||||
} |
||||
|
||||
static void Swap(int[] array, int index1, int index2) |
||||
{ |
||||
int tmp = array[index1]; |
||||
array[index1] = array[index2]; |
||||
array[index2] = tmp; |
||||
} |
||||
} |
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{9C2A1C63-38EA-42CA-BDDD-7D80D9592893}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Exe</OutputType> |
||||
<RootNamespace>QuickSort</RootNamespace> |
||||
<AssemblyName>QuickSort</AssemblyName> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>bin\Debug\</OutputPath> |
||||
<DebugSymbols>True</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="AssemblyInfo.cs" /> |
||||
<Compile Include="Program.cs" /> |
||||
</ItemGroup> |
||||
</Project> |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00 |
||||
# Visual Studio 2005 |
||||
# SharpDevelop 3.0.0.2707 |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickSort", "QuickSort.csproj", "{9C2A1C63-38EA-42CA-BDDD-7D80D9592893}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Release|Any CPU = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{9C2A1C63-38EA-42CA-BDDD-7D80D9592893}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{9C2A1C63-38EA-42CA-BDDD-7D80D9592893}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{9C2A1C63-38EA-42CA-BDDD-7D80D9592893}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{9C2A1C63-38EA-42CA-BDDD-7D80D9592893}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
EndGlobalSection |
||||
EndGlobal |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,135 +0,0 @@
@@ -1,135 +0,0 @@
|
||||
.assembly extern mscorlib |
||||
{ |
||||
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) |
||||
.ver 4:0:0:0 |
||||
} |
||||
.assembly StackTests |
||||
{ |
||||
.hash algorithm 0x00008004 |
||||
.ver 1:0:4059:39717 |
||||
} |
||||
.module StackTests.exe |
||||
.imagebase 0x00400000 |
||||
.file alignment 0x00000200 |
||||
.stackreserve 0x00100000 |
||||
.subsystem 0x0003 // WINDOWS_CUI |
||||
.corflags 0x00000003 // ILONLY 32BITREQUIRED |
||||
|
||||
.class private auto ansi beforefieldinit StackTests.Program extends [mscorlib]System.Object |
||||
{ |
||||
.method public hidebysig static void Main(string[] args) cil managed |
||||
{ |
||||
.entrypoint |
||||
.maxstack 8 |
||||
|
||||
ldc.i4.0 |
||||
call string StackTests.Program::Test1(bool cond) |
||||
call void [mscorlib]System.Console::WriteLine(string) // false |
||||
|
||||
ldc.i4.1 |
||||
call string StackTests.Program::Test1(bool cond) |
||||
call void [mscorlib]System.Console::WriteLine(string) // true |
||||
|
||||
ldc.i4.0 |
||||
ldc.i4.0 |
||||
ldc.i4.0 |
||||
call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2) |
||||
call void [mscorlib]System.Console::WriteLine(int32) // 11 |
||||
|
||||
ldc.i4.0 |
||||
ldc.i4.1 |
||||
ldc.i4.0 |
||||
call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2) |
||||
call void [mscorlib]System.Console::WriteLine(int32) // 21 |
||||
|
||||
ldc.i4.1 |
||||
ldc.i4.1 |
||||
ldc.i4.1 |
||||
call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2) |
||||
call void [mscorlib]System.Console::WriteLine(int32) // 32 |
||||
|
||||
ldc.i4.2 |
||||
ldc.i4.1 |
||||
ldc.i4.0 |
||||
call int32 StackTests.Program::Test2(int32 switch1, int32 br1, int32 br2) |
||||
call void [mscorlib]System.Console::WriteLine(int32) // 23 |
||||
|
||||
ret |
||||
} |
||||
|
||||
.method public hidebysig static string Test1(bool cond) cil managed |
||||
{ |
||||
ldarg.0 |
||||
brtrue TRUE |
||||
|
||||
FALSE: |
||||
ldstr "false" |
||||
br EXIT |
||||
|
||||
TRUE: |
||||
ldstr "true" |
||||
|
||||
EXIT: |
||||
ret |
||||
} |
||||
|
||||
.method public hidebysig static int32 Test2(int32 switch1, int32 br1, int32 br2) cil managed |
||||
{ |
||||
ldarg.0 |
||||
switch (ENTRY1, ENTRY2, ENTRY3) |
||||
ldc.i4.0 |
||||
ret |
||||
|
||||
ENTRY1: |
||||
ldc.i4.1 |
||||
br BRANCH1 |
||||
|
||||
ENTRY2: |
||||
ldc.i4.2 |
||||
br BRANCH1 |
||||
|
||||
ENTRY3: |
||||
ldc.i4.3 |
||||
br BRANCH2 |
||||
|
||||
BRANCH1: |
||||
ldarg.1 |
||||
brtrue BRANCH2 |
||||
|
||||
EXIT1: |
||||
ldc.i4 10 |
||||
add |
||||
ret |
||||
|
||||
BRANCH2: |
||||
ldarg.2 |
||||
brtrue.s EXIT3 |
||||
|
||||
EXIT2: |
||||
ldc.i4 20 |
||||
add |
||||
ret |
||||
|
||||
EXIT3: |
||||
ldc.i4 30 |
||||
add |
||||
ret |
||||
} |
||||
|
||||
.method public hidebysig specialname rtspecialname |
||||
instance void .ctor() cil managed |
||||
{ |
||||
// Code size 7 (0x7) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: call instance void [mscorlib]System.Object::.ctor() |
||||
IL_0006: ret |
||||
} // end of method Program::.ctor |
||||
|
||||
} // end of class StackTests.Program |
||||
|
||||
|
||||
// ============================================================= |
||||
|
||||
// *********** DISASSEMBLY COMPLETE *********************** |
||||
// WARNING: Created Win32 resource file D:\git\ILSpy\Decompiler\tests\Stack\StackTests.res |
Loading…
Reference in new issue