Skip to content

Commit

Permalink
fix spelling in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dadhi committed Jul 25, 2022
1 parent 5d5e3bc commit 2b7e3e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"cSpell.words": [
"cref",
"Hasher",
"langword",
"prepended",
"rebalance",
"skipci"
],
Expand Down
28 changes: 14 additions & 14 deletions src/ImTools/ImTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public static T[] Copy<T>(this T[] source)
return copy;
}

/// <summary>Array copy without checking the items for the null or the emptyness</summary>
/// <summary>Array copy without checking the items for the null or the emptiness</summary>
[MethodImpl((MethodImplOptions)256)]
public static T[] CopyNonEmpty<T>(this T[] source)
{
Expand Down Expand Up @@ -2106,7 +2106,7 @@ internal virtual StringBuilder ToMermaidString(StringBuilder s) =>
/// If hash does not match the method returns `null`</summary>
internal virtual Entry GetEntryOrNull(int hash) => null;

/// <summary>Assumes the hash is present in the map (because the map is immutable if we know the hash is present then it cannote disappear)
/// <summary>Assumes the hash is present in the map (because the map is immutable if we know the hash is present then it cannot disappear)
/// otherwise the result. Returns the Entry with the `hash` though it may be a `HashConflictingEntry`</summary>
internal virtual Entry GetSurePresentEntry(int hash) => throw new InvalidOperationException("The sure present hash does not exist in the empty map");

Expand Down Expand Up @@ -6053,20 +6053,20 @@ public static ImHashMap<K, V> Remove<K, V>(this ImHashMap<K, V> map, K key) =>
}

/// <summary>
/// The fixed array of maps (partitions) where the key first (lower) bits are used to locate the partion to lookup into.
/// The fixed array of maps (partitions) where the key first (lower) bits are used to locate the partition to lookup into.
/// Note: The partition array is NOT immutable and operates by swapping the updated partition with the new one.
/// The number of partitions may be specified by user or you can use the default number 16.
/// The default number 16 was selected to be not so big to pay for the few items and not so small to diminish the use of partitions.
/// </summary>
public static class PartitionedHashMap
{
/// <summary>The default number of partions</summary>
/// <summary>The default number of partitions</summary>
public const int PARTITION_COUNT_POWER_OF_TWO = 16;

/// <summary>The default mask to partition the key</summary>
public const int PARTITION_HASH_MASK = PARTITION_COUNT_POWER_OF_TWO - 1;

/// <summary>Creates the new collection with the empty partions</summary>
/// <summary>Creates the new collection with the empty partitions</summary>
[MethodImpl((MethodImplOptions)256)]
public static ImHashMap<K, V>[] CreateEmpty<K, V>(int partitionCountOfPowerOfTwo = PARTITION_COUNT_POWER_OF_TWO)
{
Expand All @@ -6076,7 +6076,7 @@ public static ImHashMap<K, V>[] CreateEmpty<K, V>(int partitionCountOfPowerOfTwo
return parts;
}

/// <summary>Creates the new collection with the empty partions</summary>
/// <summary>Creates the new collection with the empty partitions</summary>
[MethodImpl((MethodImplOptions)256)]
public static ImHashMap<int, V>[] CreateEmpty<V>(int partitionCountOfPowerOfTwo = PARTITION_COUNT_POWER_OF_TWO)
{
Expand Down Expand Up @@ -6170,7 +6170,7 @@ public static bool TryFindByReferenceEquals<K, V>(this ImHashMap<K, V>[] parts,
int partHashMask = PARTITION_HASH_MASK) where K : class =>
parts.TryFindByReferenceEquals(key.GetHashCode(), key, out value, partHashMask);

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrUpdate<V>(this ImHashMap<int, V>[] parts, int hash, V value, int partHashMask = PARTITION_HASH_MASK)
{
Expand All @@ -6183,7 +6183,7 @@ public static void AddOrUpdate<V>(this ImHashMap<int, V>[] parts, int hash, V va
private static void RefAddOrUpdatePart<V>(ref ImHashMap<int, V> part, int hash, V value) =>
Ref.Swap(ref part, hash, value, (x, h, v) => x.AddOrUpdate(h, v));

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrUpdate<K, V>(this ImHashMap<K, V>[] parts, int hash, K key, V value, int partHashMask = PARTITION_HASH_MASK)
{
Expand All @@ -6193,15 +6193,15 @@ public static void AddOrUpdate<K, V>(this ImHashMap<K, V>[] parts, int hash, K k
RefAddOrUpdatePart(ref part, hash, key, value);
}

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrUpdate<K, V>(this ImHashMap<K, V>[] parts, K key, V value, int partHashMask = PARTITION_HASH_MASK) =>
parts.AddOrUpdate(key.GetHashCode(), key, value, partHashMask);

private static void RefAddOrUpdatePart<K, V>(ref ImHashMap<K, V> part, int hash, K key, V value) =>
Ref.Swap(ref part, hash, key, value, (x, h, k, v) => x.AddOrUpdate(h, k, v));

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrUpdate<V>(this ImHashMap<int, V>[] parts, int hash, V value, Update<int, V> update, int partHashMask = PARTITION_HASH_MASK)
{
Expand All @@ -6211,7 +6211,7 @@ public static void AddOrUpdate<V>(this ImHashMap<int, V>[] parts, int hash, V va
Ref.Swap(ref part, hash, value, update, (x, h, k, u) => x.AddOrUpdate(h, k, u));
}

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrUpdate<K, V>(this ImHashMap<K, V>[] parts, int hash, K key, V value, Update<K, V> update, int partHashMask = PARTITION_HASH_MASK)
{
Expand All @@ -6221,12 +6221,12 @@ public static void AddOrUpdate<K, V>(this ImHashMap<K, V>[] parts, int hash, K k
Ref.Swap(ref part, hash, key, value, update, (x, h, k, v, u) => x.AddOrUpdate(h, k, v, u));
}

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or updated partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrUpdate<K, V>(this ImHashMap<K, V>[] parts, K key, V value, Update<K, V> update, int partHashMask = PARTITION_HASH_MASK) =>
parts.AddOrUpdate(key.GetHashCode(), key, value, update);

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or the same kept partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or the same kept partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrKeep<V>(this ImHashMap<int, V>[] parts, int hash, V value, int partHashMask = PARTITION_HASH_MASK)
{
Expand All @@ -6239,7 +6239,7 @@ public static void AddOrKeep<V>(this ImHashMap<int, V>[] parts, int hash, V valu
private static void RefAddOrKeepPart<V>(ref ImHashMap<int, V> part, int hash, V value) =>
Ref.Swap(ref part, hash, value, (x, h, v) => x.AddOrUpdate(h, v));

/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or the same kept partion</summary>
/// <summary>Returns the SAME partitioned maps array instance but with the NEW added or the same kept partition</summary>
[MethodImpl((MethodImplOptions)256)]
public static void AddOrKeep<K, V>(this ImHashMap<K, V>[] parts, int hash, K key, V value, int partHashMask = PARTITION_HASH_MASK)
{
Expand Down

0 comments on commit 2b7e3e6

Please sign in to comment.