View PolyNomial.cs
public class PolyNomial
{
public int[] _coefficients;
public PolyNomial()
{
}
public PolyNomial(int degree)
{
_coefficients = new int[degree];
}
View GetObjBytes.cs
public static byte[] GetObjBytes(object obj, Type type = null)
{
Type _type;
if (type == null)
_type = obj.GetType();
else
_type = type;
switch (_type.Name)
{
case "Byte":
View TinyHashSet.cs
public class TinyHashSet<T> : IEnumerable<T>
{
private readonly IEqualityComparer<T> _comparer;
private int[] _hashBuckets;
private uint[] _hashcodes;
private int[] _next;
public T[] Items;
public int Version;
public TinyHashSet() : this(1, EqualityComparer<T>.Default)
{
View TinyDictionary.cs
public class TinyDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
{
private readonly IEqualityComparer<TKey> _comparer;
private int[] _hashBuckets;
private uint[] _hashcodes;
private int[] _next;
private TinyHashSet<TValue> _searchValues;
public TKey[] Keys;
public TValue[] Values;
public int Version;
View CRng.cs
[Serializable]
public class CRng
{
private static readonly double ED_Char = 1.0 / char.MaxValue;
private static readonly double ED_SByte = 1.0 / sbyte.MaxValue;
private static readonly double ED_Byte = 1.0 / byte.MaxValue;
private static readonly double ED_Short = 1.0 / short.MaxValue;
private static readonly double ED_UShort = 1.0 / ushort.MaxValue;
private static readonly double ED_Int = 1.0 / int.MaxValue;
private static readonly double ED_UInt = 1.0 / uint.MaxValue;
View LimitedList.cs
[Serializable]
public class LimitedList<T> : IEnumerable<T>
{
private T[] _thing;
public LimitedList(int maxsize)
{
_thing = new T[maxsize];
MaxSize = maxsize;
}
private int MaxSize { get; }
View Entropy.cs
public static class Entropy
{
private static readonly int[] _map = new int[256];
private static bool _mapStatus;
static Entropy()
{
_map.Fill(0);
_mapStatus = false;
}
public static double GetEntropy(this char[] value)
View LinqHelper.cs
public static class LinqHelper
{
/// <summary>
/// Generates a sequence of character values within a specified range starting at
/// 'form' through 'to' with a given step value.
/// </summary>
public static IEnumerable<char> Range(char from, char to, char step = '\x0001')
{
var d = '\x0';
while (d < to)
View ProgressBarEx.cs
public class ProgressBarEx : PictureBox
{
public enum AniMode
{
Bounce,
LeftToRight
}
/// <summary>
/// Specifies how the bar is drawn either simple = standard or complex = including a graph at percent
/// </summary>
View StreamEx.cs
public static Dictionary<int, TimeSpan> BufferSizeTest()
{
const int NumberOfTasks = 10;
const int IterationsPerTask = 100;
const int SourceFileLength = 2 * 1024 * 1024;
var BufferSizes = new[] {4096, 80 * 1024, 1 * 1024 * 1024, 10 * 1024 * 1024};
const string sourcePath = @"s:\test\source.bin";
var sw = new Stopwatch();
var tasks = new Task[NumberOfTasks];
var testResults = new Dictionary<int, TimeSpan>();