Skip to content

Commit cca0d4c

Browse files
committed
renaming probes to probe
1 parent 38e93b9 commit cca0d4c

File tree

2 files changed

+43
-46
lines changed

2 files changed

+43
-46
lines changed

.vscode/launch.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
// Use hover for the description of the existing attributes
44
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
55
"version": "0.2.0",
6-
"sourceFileMap": {
7-
"/_/src/FastExpressionCompiler/FastExpressionCompiler.cs": "E:\\Dev\\FastExpressionCompiler\\src\\FastExpressionCompiler\\FastExpressionCompiler.cs",
8-
"/_/src/FastExpressionCompiler.LightExpression/FastExpressionCompiler.cs": "E:\\Dev\\FastExpressionCompiler\\src\\FastExpressionCompiler\\FastExpressionCompiler.cs",
9-
"/_/src/FastExpressionCompiler.LightExpression/Expression.cs": "E:\\Dev\\FastExpressionCompiler\\src\\FastExpressionCompiler.LightExpression\\Expression.cs"
10-
},
116
"configurations": [
127
{
138
"name": "TestsRunner",
@@ -16,7 +11,9 @@
1611
"preLaunchTask": "build_testsrunner",
1712
// If you have changed target frameworks, make sure to update the program path.
1813
"program": "${workspaceFolder}/test/FastExpressionCompiler.TestsRunner/bin/Debug/net9.0/FastExpressionCompiler.TestsRunner.dll",
19-
"args": [],
14+
"args": [
15+
"/p:UseSourceLink=false"
16+
],
2017
"cwd": "${workspaceFolder}/test/FastExpressionCompiler.TestsRunner",
2118
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
2219
"console": "internalConsole",

src/FastExpressionCompiler/ImTools.cs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,37 +1154,37 @@ private ref TEntry AddOrGetRefInEntries(K key, out bool found)
11541154
ref var h = ref hashesAndIndexes.GetSurePresentItemRef(hashIndex);
11551155

11561156
// 1. Skip over hashes with the bigger and equal probes. The hashes with bigger probes overlapping from the earlier ideal positions
1157-
var probes = 1;
1158-
while ((h >>> ProbeCountShift) >= probes)
1157+
var probe = 1;
1158+
while ((h >>> ProbeCountShift) >= probe)
11591159
{
11601160
// 2. For the equal probes check for equality the hash middle part, and update the entry if the keys are equal too
1161-
if (((h >>> ProbeCountShift) == probes) & ((h & hashMiddleMask) == hashMiddle))
1161+
if (((h >>> ProbeCountShift) == probe) & ((h & hashMiddleMask) == hashMiddle))
11621162
{
11631163
ref var e = ref GetSurePresentEntryRef(h & indexMask);
11641164
if (found = default(TEq).Equals(e.Key, key))
11651165
return ref e;
11661166
}
11671167
h = ref hashesAndIndexes.GetSurePresentItemRef(++hashIndex & indexMask);
1168-
++probes;
1168+
++probe;
11691169
}
11701170
found = false;
11711171

11721172
// 3. We did not find the hash and therefore the key, so insert the new entry
11731173
var hRobinHooded = h;
1174-
h = (probes << ProbeCountShift) | hashMiddle | _count;
1174+
h = (probe << ProbeCountShift) | hashMiddle | _count;
11751175

11761176
// 4. If the robin hooded hash is empty then we stop
11771177
// 5. Otherwise we steal the slot with the smaller probes
1178-
probes = hRobinHooded >>> ProbeCountShift;
1178+
probe = hRobinHooded >>> ProbeCountShift;
11791179
while (hRobinHooded != 0)
11801180
{
11811181
h = ref hashesAndIndexes.GetSurePresentItemRef(++hashIndex & indexMask);
1182-
if ((h >>> ProbeCountShift) < ++probes)
1182+
if ((h >>> ProbeCountShift) < ++probe)
11831183
{
11841184
var tmp = h;
1185-
h = (probes << ProbeCountShift) | (hRobinHooded & HashAndIndexMask);
1185+
h = (probe << ProbeCountShift) | (hRobinHooded & HashAndIndexMask);
11861186
hRobinHooded = tmp;
1187-
probes = hRobinHooded >>> ProbeCountShift;
1187+
probe = hRobinHooded >>> ProbeCountShift;
11881188
}
11891189
}
11901190

@@ -1202,29 +1202,29 @@ private void AddJustHashAndEntryIndexWithoutResizing(int hash, int index)
12021202
#endif
12031203
// 1. Skip over hashes with the bigger and equal probes. The hashes with bigger probes overlapping from the earlier ideal positions
12041204
ref var h = ref hashesAndIndexes.GetSurePresentItemRef(hashIndex);
1205-
var probes = 1;
1206-
while ((h >>> ProbeCountShift) >= probes)
1205+
var probe = 1;
1206+
while ((h >>> ProbeCountShift) >= probe)
12071207
{
12081208
h = ref hashesAndIndexes.GetSurePresentItemRef(++hashIndex & IndexMask);
1209-
++probes;
1209+
++probe;
12101210
}
12111211

12121212
// 3. We did not find the hash and therefore the key, so insert the new entry
12131213
var hRobinHooded = h;
1214-
h = (probes << ProbeCountShift) | (hash & HashMask) | index;
1214+
h = (probe << ProbeCountShift) | (hash & HashMask) | index;
12151215

12161216
// 4. If the robin hooded hash is empty then we stop
12171217
// 5. Otherwise we steal the slot with the smaller probes
1218-
probes = hRobinHooded >>> ProbeCountShift;
1218+
probe = hRobinHooded >>> ProbeCountShift;
12191219
while (hRobinHooded != 0)
12201220
{
12211221
h = ref hashesAndIndexes.GetSurePresentItemRef(++hashIndex & IndexMask);
1222-
if ((h >>> ProbeCountShift) < ++probes)
1222+
if ((h >>> ProbeCountShift) < ++probe)
12231223
{
12241224
var tmp = h;
1225-
h = (probes << ProbeCountShift) | (hRobinHooded & HashAndIndexMask);
1225+
h = (probe << ProbeCountShift) | (hRobinHooded & HashAndIndexMask);
12261226
hRobinHooded = tmp;
1227-
probes = hRobinHooded >>> ProbeCountShift;
1227+
probe = hRobinHooded >>> ProbeCountShift;
12281228
}
12291229
}
12301230
}
@@ -1282,25 +1282,25 @@ public ref TEntry AddOrGetEntryRef(K key, out bool found)
12821282
Index: 0 1 2 3 4 5 6 7
12831283
Hash: [0] [0] [0] [0] [0] [0] [0] [0]
12841284
1285-
2. Insert that key A with the hash 13, which is 0b0011_0101. 13 & 7 Mask = 5, so the index is 5.
1285+
2. Insert the key A with the hash 13, which is 0b0011_0101. 13 & 7 Mask = 5, so the index is 5.
12861286
12871287
Index: 0 1 2 3 4 5 6 7
12881288
Hash: [0] [0] [0] [0] [0] [13] [0] [0]
12891289
Probe: 1A
12901290
1291-
3. Insert that key B with the hash 5, which is 0b0000_1011. 5 & 7 Mask = 5, so the index is again 5.
1291+
3. Insert the key B with the hash 5, which is 0b0000_1011. 5 & 7 Mask = 5, so the index is again 5.
12921292
12931293
Index: 0 1 2 3 4 5 6 7
12941294
Hash: [0] [0] [0] [0] [0] [13] [5] [0]
12951295
Probe 1A 2B
12961296
1297-
4. Insert that key C with the hash 7, which is 0b0010_0101. 7 & 7 Mask = 7, so the index is 7.
1297+
4. Insert the key C with the hash 7, which is 0b0010_0101. 7 & 7 Mask = 7, so the index is 7.
12981298
12991299
Index: 0 1 2 3 4 5 6 7
13001300
Hash: [0] [0] [0] [0] [0] [13] [5] [7]
13011301
Probe: 1A 2B 1C
13021302
1303-
5. Insert that key D with the hash 21, which is 0b0101_0101. 21 & 7 Mask = 5, so the index is again again 5.
1303+
5. Insert the key D with the hash 21, which is 0b0101_0101. 21 & 7 Mask = 5, so the index is again again 5.
13041304
13051305
Index: 0 1 2 3 4 5 6 7
13061306
Hash: [7] [0] [0] [0] [0] [13] [5] [21]
@@ -1325,29 +1325,29 @@ private ref TEntry AddSureAbsentDefaultAndGetRefInEntries(K key)
13251325
ref var h = ref hashesAndIndexes.GetSurePresentItemRef(hashIndex);
13261326

13271327
// 1. Skip over hashes with the bigger and equal probes. The hashes with bigger probes overlapping from the earlier ideal positions
1328-
var probes = 1;
1329-
while ((h >>> ProbeCountShift) >= probes)
1328+
var probe = 1;
1329+
while ((h >>> ProbeCountShift) >= probe)
13301330
{
13311331
h = ref hashesAndIndexes.GetSurePresentItemRef(++hashIndex & indexMask);
1332-
++probes;
1332+
++probe;
13331333
}
13341334

13351335
// 3. We did not find the hash and therefore the key, so insert the new entry
13361336
var hRobinHooded = h;
1337-
h = (probes << ProbeCountShift) | (hash & HashAndIndexMask & ~indexMask) | _count;
1337+
h = (probe << ProbeCountShift) | (hash & HashAndIndexMask & ~indexMask) | _count;
13381338

13391339
// 4. If the robin hooded hash is empty then we stop
13401340
// 5. Otherwise we steal the slot with the smaller probes
1341-
probes = hRobinHooded >>> ProbeCountShift;
1341+
probe = hRobinHooded >>> ProbeCountShift;
13421342
while (hRobinHooded != 0)
13431343
{
13441344
h = ref hashesAndIndexes.GetSurePresentItemRef(++hashIndex & indexMask);
1345-
if ((h >>> ProbeCountShift) < ++probes)
1345+
if ((h >>> ProbeCountShift) < ++probe)
13461346
{
13471347
var tmp = h;
1348-
h = (probes << ProbeCountShift) | (hRobinHooded & HashAndIndexMask);
1348+
h = (probe << ProbeCountShift) | (hRobinHooded & HashAndIndexMask);
13491349
hRobinHooded = tmp;
1350-
probes = hRobinHooded >>> ProbeCountShift;
1350+
probe = hRobinHooded >>> ProbeCountShift;
13511351
}
13521352
}
13531353

@@ -1422,19 +1422,19 @@ internal ref TEntry TryGetRefInEntries(K key, out bool found)
14221422
var h = hashesAndIndexes.GetSurePresentItem(hashIndex);
14231423

14241424
// 1. Skip over hashes with the bigger and equal probes. The hashes with bigger probes overlapping from the earlier ideal positions
1425-
var probes = 1;
1426-
while ((h >>> ProbeCountShift) >= probes)
1425+
var probe = 1;
1426+
while ((h >>> ProbeCountShift) >= probe)
14271427
{
14281428
// 2. For the equal probes check for equality the hash middle part, and update the entry if the keys are equal too
1429-
if (((h >>> ProbeCountShift) == probes) & ((h & hashMiddleMask) == hashMiddle))
1429+
if (((h >>> ProbeCountShift) == probe) & ((h & hashMiddleMask) == hashMiddle))
14301430
{
14311431
ref var e = ref GetSurePresentEntryRef(h & indexMask);
14321432
if (found = default(TEq).Equals(e.Key, key))
14331433
return ref e;
14341434
}
14351435

14361436
h = hashesAndIndexes.GetSurePresentItem(++hashIndex & indexMask);
1437-
++probes;
1437+
++probe;
14381438
}
14391439

14401440
found = false;
@@ -1462,20 +1462,20 @@ internal ref TEntry TryGetRefInEntries2(K key, out bool found)
14621462
var h = hashesAndIndexes.GetSurePresentItem(hashIndex);
14631463

14641464
// 1. Skip over hashes with the bigger and equal probes. The hashes with bigger probes overlapping from the earlier ideal positions
1465-
var probes = 1;
1465+
var probe = 1;
14661466

1467-
while ((h >>> ProbeCountShift) >= probes)
1467+
while ((h >>> ProbeCountShift) >= probe)
14681468
{
14691469
// 2. For the equal probes check for equality the hash middle part, then check the entry
1470-
if (((h >>> ProbeCountShift) == probes) & ((h & hashMiddleMask) == hashMiddle))
1470+
if (((h >>> ProbeCountShift) == probe) & ((h & hashMiddleMask) == hashMiddle))
14711471
{
14721472
ref var e = ref GetSurePresentEntryRef(h & indexMask);
14731473
if (found = default(TEq).Equals(e.Key, key))
14741474
return ref e;
14751475
}
14761476

14771477
h = hashesAndIndexes.GetSurePresentItem(++hashIndex & indexMask);
1478-
++probes;
1478+
++probe;
14791479
}
14801480

14811481
found = false;
@@ -1523,14 +1523,14 @@ internal int ResizeHashes(int indexMask)
15231523
var indexWithNextBit = (oldHash & oldCapacity) | (((i + 1) - (oldHash >>> ProbeCountShift)) & indexMask);
15241524

15251525
// no need for robin-hooding because we already did it for the old hashes and now just filling the hashes into the new array which are already in order
1526-
var probes = 1;
1526+
var probe = 1;
15271527
ref var newHash = ref newHashes.GetSurePresentItemRef(indexWithNextBit);
15281528
while (newHash != 0)
15291529
{
15301530
newHash = ref newHashes.GetSurePresentItemRef(++indexWithNextBit & newIndexMask);
1531-
++probes;
1531+
++probe;
15321532
}
1533-
newHash = (probes << ProbeCountShift) | (oldHash & newHashAndIndexMask);
1533+
newHash = (probe << ProbeCountShift) | (oldHash & newHashAndIndexMask);
15341534
}
15351535
if (++i >= oldCapacityWithOverflowSegment)
15361536
break;

0 commit comments

Comments
 (0)