@woosh/meep-engine 2.117.18 → 2.117.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/meep.cjs +117 -112
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +117 -112
- package/package.json +1 -1
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +112 -108
- package/src/engine/graphics/material/manager/ManagedTexture.d.ts +0 -3
- package/src/engine/graphics/material/manager/ManagedTexture.d.ts.map +0 -1
- package/src/engine/graphics/material/manager/ManagedTexture.js +0 -3
- package/src/engine/graphics/material/manager/TextureManager.d.ts +0 -3
- package/src/engine/graphics/material/manager/TextureManager.d.ts.map +0 -1
- package/src/engine/graphics/material/manager/TextureManager.js +0 -3
|
@@ -6,7 +6,6 @@ import { min2 } from "../../math/min2.js";
|
|
|
6
6
|
import { invokeObjectEquals } from "../../model/object/invokeObjectEquals.js";
|
|
7
7
|
import { invokeObjectHash } from "../../model/object/invokeObjectHash.js";
|
|
8
8
|
import { array_copy } from "../array/array_copy.js";
|
|
9
|
-
import { array_swap_one } from "../array/array_swap_one.js";
|
|
10
9
|
import { UintArrayForCount } from "../array/typed/uint_array_for_count.js";
|
|
11
10
|
|
|
12
11
|
/*
|
|
@@ -140,62 +139,62 @@ export class HashMap {
|
|
|
140
139
|
* number of bins is always power or two
|
|
141
140
|
* @type {Uint32Array}
|
|
142
141
|
*/
|
|
143
|
-
|
|
142
|
+
__bins = EMPTY_BINS;
|
|
144
143
|
|
|
145
144
|
/**
|
|
146
145
|
* Note that dead entries are marked as such with a special reserved hash values, so records can be reused for new entries
|
|
147
146
|
* @type {Array<HashMapEntry<K,V>>}
|
|
148
147
|
*/
|
|
149
|
-
|
|
148
|
+
__entries = new Array(0);
|
|
150
149
|
|
|
151
150
|
/**
|
|
152
151
|
* Pointer to the end of allocated entries segment
|
|
153
152
|
* @type {number}
|
|
154
153
|
*/
|
|
155
|
-
|
|
154
|
+
__entries_bound = 0;
|
|
156
155
|
|
|
157
156
|
/**
|
|
158
157
|
*
|
|
159
158
|
* @type {number}
|
|
160
159
|
*/
|
|
161
|
-
|
|
160
|
+
__entries_start = 0;
|
|
162
161
|
|
|
163
162
|
/**
|
|
164
163
|
* number of records in the map
|
|
165
164
|
* @type {number}
|
|
166
165
|
*/
|
|
167
|
-
|
|
166
|
+
__size = 0;
|
|
168
167
|
|
|
169
|
-
|
|
168
|
+
__bin_count = 0;
|
|
170
169
|
|
|
171
170
|
/**
|
|
172
171
|
* Always exactly half of the number of bins
|
|
173
172
|
* @type {number}
|
|
174
173
|
*/
|
|
175
|
-
|
|
174
|
+
__entries_allocated_count = 0;
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
__bin_count_power_of_two = 0;
|
|
178
177
|
|
|
179
|
-
|
|
178
|
+
__entries_count_power_of_two = 0;
|
|
180
179
|
|
|
181
180
|
/**
|
|
182
181
|
* Mask used to map from hash to a bin index
|
|
183
182
|
* @type {number}
|
|
184
183
|
*/
|
|
185
|
-
|
|
184
|
+
__bin_count_mask = 0;
|
|
186
185
|
|
|
187
186
|
/**
|
|
188
187
|
* How full the table can get before number of buckets is increased
|
|
189
188
|
* @type {number}
|
|
190
189
|
* @private
|
|
191
190
|
*/
|
|
192
|
-
|
|
191
|
+
__load_factor = DEFAULT_LOAD_FACTOR;
|
|
193
192
|
|
|
194
193
|
/**
|
|
195
194
|
* Used to track modifications to prevent concurrent changes during iteration
|
|
196
195
|
* @type {number}
|
|
197
196
|
*/
|
|
198
|
-
|
|
197
|
+
__version = 0;
|
|
199
198
|
|
|
200
199
|
/**
|
|
201
200
|
* @template K, V
|
|
@@ -234,13 +233,13 @@ export class HashMap {
|
|
|
234
233
|
*/
|
|
235
234
|
this.keyEqualityFunction = keyEqualityFunction;
|
|
236
235
|
|
|
237
|
-
this
|
|
236
|
+
this.__load_factor = loadFactor;
|
|
238
237
|
|
|
239
238
|
this.#setBinCount(ceilPowerOfTwo(capacity));
|
|
240
239
|
}
|
|
241
240
|
|
|
242
241
|
get size() {
|
|
243
|
-
return this
|
|
242
|
+
return this.__size;
|
|
244
243
|
}
|
|
245
244
|
|
|
246
245
|
/**
|
|
@@ -248,7 +247,7 @@ export class HashMap {
|
|
|
248
247
|
* @returns {number}
|
|
249
248
|
*/
|
|
250
249
|
getCurrentLoad() {
|
|
251
|
-
return this
|
|
250
|
+
return this.__size / this.__bin_count;
|
|
252
251
|
}
|
|
253
252
|
|
|
254
253
|
/**
|
|
@@ -260,33 +259,33 @@ export class HashMap {
|
|
|
260
259
|
assert.isNonNegativeInteger(count, 'count');
|
|
261
260
|
assert.equal(isPowerOfTwo(count), true, `count must be a power of two, instead was ${count}`);
|
|
262
261
|
|
|
263
|
-
if (count < this
|
|
264
|
-
throw new Error(`count must be at least equal to must of records in the map (=${this
|
|
262
|
+
if (count < this.__size) {
|
|
263
|
+
throw new Error(`count must be at least equal to must of records in the map (=${this.__size}), instead was ${count}`);
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
|
|
268
|
-
this
|
|
269
|
-
this
|
|
267
|
+
this.__entries_count_power_of_two = ctz32(count);
|
|
268
|
+
this.__bin_count_power_of_two = this.__entries_count_power_of_two + 1;
|
|
270
269
|
|
|
271
|
-
this
|
|
272
|
-
this
|
|
270
|
+
this.__bin_count = 2 ** this.__bin_count_power_of_two;
|
|
271
|
+
this.__bin_count_mask = this.__bin_count - 1;
|
|
273
272
|
|
|
274
|
-
const old_entry_allocation_count = this
|
|
273
|
+
const old_entry_allocation_count = this.__entries_allocated_count;
|
|
275
274
|
|
|
276
|
-
this
|
|
275
|
+
this.__entries_allocated_count = 2 ** this.__entries_count_power_of_two;
|
|
277
276
|
|
|
278
|
-
const BinsArray = UintArrayForCount(this
|
|
277
|
+
const BinsArray = UintArrayForCount(this.__entries_allocated_count + ENTRY_BASE);
|
|
279
278
|
|
|
280
|
-
this
|
|
279
|
+
this.__bins = new BinsArray(this.__bin_count);
|
|
281
280
|
|
|
282
|
-
const new_entries = new Array(this
|
|
283
|
-
const old_entries = this
|
|
281
|
+
const new_entries = new Array(this.__entries_allocated_count);
|
|
282
|
+
const old_entries = this.__entries;
|
|
284
283
|
|
|
285
|
-
this
|
|
284
|
+
this.__entries = new_entries;
|
|
286
285
|
|
|
287
|
-
array_copy(old_entries, 0, new_entries, 0, min2(old_entry_allocation_count, this
|
|
286
|
+
array_copy(old_entries, 0, new_entries, 0, min2(old_entry_allocation_count, this.__entries_allocated_count));
|
|
288
287
|
|
|
289
|
-
if (this
|
|
288
|
+
if (this.__size > 0) {
|
|
290
289
|
// re-hash
|
|
291
290
|
this.rebuild();
|
|
292
291
|
}
|
|
@@ -298,7 +297,7 @@ export class HashMap {
|
|
|
298
297
|
* @returns {number}
|
|
299
298
|
* @private
|
|
300
299
|
*/
|
|
301
|
-
|
|
300
|
+
compute_bin_index(hash) {
|
|
302
301
|
assert.isInteger(hash, 'hash');
|
|
303
302
|
|
|
304
303
|
// mix the input hash to minimize potential impact of poor hash function spread
|
|
@@ -307,7 +306,7 @@ export class HashMap {
|
|
|
307
306
|
// force index to unsigned integer
|
|
308
307
|
const index = mixed_hash >>> 0;
|
|
309
308
|
|
|
310
|
-
return index & this
|
|
309
|
+
return index & this.__bin_count_mask;
|
|
311
310
|
}
|
|
312
311
|
|
|
313
312
|
/**
|
|
@@ -355,15 +354,15 @@ export class HashMap {
|
|
|
355
354
|
*/
|
|
356
355
|
#allocate_entry(k, v, hash) {
|
|
357
356
|
|
|
358
|
-
const i = this
|
|
357
|
+
const i = this.__entries_bound;
|
|
359
358
|
|
|
360
|
-
this
|
|
359
|
+
this.__entries_bound++;
|
|
361
360
|
|
|
362
|
-
if (this
|
|
361
|
+
if (this.__entries[i] !== undefined) {
|
|
363
362
|
|
|
364
363
|
// entry exists, let's reuse it
|
|
365
364
|
|
|
366
|
-
const entry = this
|
|
365
|
+
const entry = this.__entries[i];
|
|
367
366
|
|
|
368
367
|
assert.equal(entry.hash, RESERVED_HASH, 'Entry is occupied');
|
|
369
368
|
|
|
@@ -375,7 +374,7 @@ export class HashMap {
|
|
|
375
374
|
|
|
376
375
|
// entry slot is empty
|
|
377
376
|
|
|
378
|
-
this
|
|
377
|
+
this.__entries[i] = new HashMapEntry(k, v, hash);
|
|
379
378
|
|
|
380
379
|
}
|
|
381
380
|
|
|
@@ -396,11 +395,11 @@ export class HashMap {
|
|
|
396
395
|
}
|
|
397
396
|
|
|
398
397
|
#rebuild_if_necessary() {
|
|
399
|
-
if (this
|
|
398
|
+
if (this.__entries_bound !== this.__entries_allocated_count) {
|
|
400
399
|
return;
|
|
401
400
|
}
|
|
402
401
|
|
|
403
|
-
if (this
|
|
402
|
+
if (this.__size === this.__entries_allocated_count) {
|
|
404
403
|
// used up all allocated entries
|
|
405
404
|
// bin count must always be larger than end of the entries table
|
|
406
405
|
this.#grow();
|
|
@@ -419,20 +418,20 @@ export class HashMap {
|
|
|
419
418
|
this.#rebuild_if_necessary();
|
|
420
419
|
|
|
421
420
|
const raw_hash = this.#build_key_hash(key);
|
|
422
|
-
let bin_index = this
|
|
421
|
+
let bin_index = this.compute_bin_index(raw_hash);
|
|
423
422
|
|
|
424
423
|
assert.isFiniteNumber(bin_index, 'hash');
|
|
425
424
|
|
|
426
425
|
let first_deleted_bin_index = UNDEFINED_BIN_INDEX;
|
|
427
426
|
|
|
428
427
|
for (; ;) {
|
|
429
|
-
const bin = this
|
|
428
|
+
const bin = this.__bins[bin_index];
|
|
430
429
|
|
|
431
430
|
if (bin > BIN_RESERVED_VALUE_DELETED) {
|
|
432
431
|
// bin is occupied
|
|
433
432
|
|
|
434
433
|
// check if it's the entry that we're looking for
|
|
435
|
-
const entry = this
|
|
434
|
+
const entry = this.__entries[bin - ENTRY_BASE];
|
|
436
435
|
|
|
437
436
|
if (this.#entry_equality_check(entry, raw_hash, key)) {
|
|
438
437
|
// found the right entry
|
|
@@ -450,17 +449,17 @@ export class HashMap {
|
|
|
450
449
|
|
|
451
450
|
const entry_index = this.#allocate_entry(key, value, raw_hash);
|
|
452
451
|
|
|
453
|
-
assert.defined(this
|
|
452
|
+
assert.defined(this.__entries[entry_index], 'entry');
|
|
454
453
|
|
|
455
|
-
assert.equal(this
|
|
456
|
-
assert.equal(this
|
|
457
|
-
assert.equal(this
|
|
454
|
+
assert.equal(this.__entries[entry_index].hash, raw_hash, 'entry.hash');
|
|
455
|
+
assert.equal(this.__entries[entry_index].value, value, 'entry.value');
|
|
456
|
+
assert.equal(this.__entries[entry_index].key, key, 'entry.key');
|
|
458
457
|
|
|
459
458
|
const bin_value = entry_index + ENTRY_BASE;
|
|
460
459
|
|
|
461
|
-
this
|
|
460
|
+
this.__bins[bin_index] = bin_value;
|
|
462
461
|
|
|
463
|
-
assert.equal(bin_value, this
|
|
462
|
+
assert.equal(bin_value, this.__bins[bin_index], 'Bin value write error');
|
|
464
463
|
|
|
465
464
|
break;
|
|
466
465
|
|
|
@@ -471,19 +470,19 @@ export class HashMap {
|
|
|
471
470
|
}
|
|
472
471
|
|
|
473
472
|
// perform secondary hashing
|
|
474
|
-
bin_index = generate_next_linear_congruential_index(bin_index, this
|
|
473
|
+
bin_index = generate_next_linear_congruential_index(bin_index, this.__bin_count_mask);
|
|
475
474
|
|
|
476
475
|
}
|
|
477
476
|
|
|
478
|
-
const old_size = this
|
|
477
|
+
const old_size = this.__size;
|
|
479
478
|
const new_size = old_size + 1;
|
|
480
|
-
this
|
|
479
|
+
this.__size = new_size;
|
|
481
480
|
|
|
482
481
|
// compute actual current load
|
|
483
|
-
const bucket_count = this
|
|
482
|
+
const bucket_count = this.__bin_count;
|
|
484
483
|
const load = new_size / bucket_count;
|
|
485
484
|
|
|
486
|
-
if (load > this
|
|
485
|
+
if (load > this.__load_factor) {
|
|
487
486
|
// current load is too high, increase table size
|
|
488
487
|
this.#grow();
|
|
489
488
|
}
|
|
@@ -497,16 +496,16 @@ export class HashMap {
|
|
|
497
496
|
get(key) {
|
|
498
497
|
const raw_hash = this.#build_key_hash(key);
|
|
499
498
|
|
|
500
|
-
let bin_index = this
|
|
499
|
+
let bin_index = this.compute_bin_index(raw_hash);
|
|
501
500
|
|
|
502
501
|
for (; ;) {
|
|
503
|
-
const bin = this
|
|
502
|
+
const bin = this.__bins[bin_index];
|
|
504
503
|
|
|
505
504
|
if (bin > BIN_RESERVED_VALUE_DELETED) {
|
|
506
505
|
// bin is occupied
|
|
507
506
|
|
|
508
507
|
// check if the entry is what we're looking for
|
|
509
|
-
const entry = this
|
|
508
|
+
const entry = this.__entries[bin - ENTRY_BASE];
|
|
510
509
|
|
|
511
510
|
if (this.#entry_equality_check(entry, raw_hash, key)) {
|
|
512
511
|
// found the right entry
|
|
@@ -519,7 +518,7 @@ export class HashMap {
|
|
|
519
518
|
}
|
|
520
519
|
|
|
521
520
|
// perform secondary hashing
|
|
522
|
-
bin_index = generate_next_linear_congruential_index(bin_index, this
|
|
521
|
+
bin_index = generate_next_linear_congruential_index(bin_index, this.__bin_count_mask);
|
|
523
522
|
|
|
524
523
|
}
|
|
525
524
|
|
|
@@ -569,24 +568,25 @@ export class HashMap {
|
|
|
569
568
|
}
|
|
570
569
|
|
|
571
570
|
/**
|
|
572
|
-
*
|
|
573
|
-
* @param {number} bin
|
|
571
|
+
* Update the entries start of table TAB after removing an entry with index N in the array entries.
|
|
572
|
+
* @param {number} bin index of deleted entry
|
|
574
573
|
*/
|
|
575
574
|
#update_range_for_deleted(bin) {
|
|
576
|
-
if (this
|
|
577
|
-
|
|
578
|
-
|
|
575
|
+
if (this.__entries_start !== bin) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
579
578
|
|
|
580
|
-
|
|
579
|
+
let start = bin + 1;
|
|
580
|
+
let bound = this.__entries_bound;
|
|
581
|
+
const entries = this.__entries;
|
|
581
582
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
583
|
+
while (start < bound && entries[start].hash === RESERVED_HASH) {
|
|
584
|
+
start++;
|
|
585
|
+
}
|
|
585
586
|
|
|
586
|
-
|
|
587
|
+
assert.greaterThanOrEqual(bound - start, this.__size, `live entity bounds must span at least number of entries equal to map size(=${this.__size}), instead got start(=${start}), and end(=${bound})`)
|
|
587
588
|
|
|
588
|
-
|
|
589
|
-
}
|
|
589
|
+
this.__entries_start = start;
|
|
590
590
|
}
|
|
591
591
|
|
|
592
592
|
/**
|
|
@@ -597,12 +597,12 @@ export class HashMap {
|
|
|
597
597
|
delete(key) {
|
|
598
598
|
|
|
599
599
|
const raw_hash = this.#build_key_hash(key);
|
|
600
|
-
let bin_index = this
|
|
600
|
+
let bin_index = this.compute_bin_index(raw_hash);
|
|
601
601
|
|
|
602
602
|
assert.isFiniteNumber(bin_index, 'hash');
|
|
603
603
|
|
|
604
|
-
const bins = this
|
|
605
|
-
const entries = this
|
|
604
|
+
const bins = this.__bins;
|
|
605
|
+
const entries = this.__entries;
|
|
606
606
|
|
|
607
607
|
for (; ;) {
|
|
608
608
|
const bin = bins[bin_index];
|
|
@@ -623,7 +623,7 @@ export class HashMap {
|
|
|
623
623
|
// mark slot as removed
|
|
624
624
|
bins[bin_index] = BIN_RESERVED_VALUE_DELETED;
|
|
625
625
|
|
|
626
|
-
this
|
|
626
|
+
this.__size--;
|
|
627
627
|
|
|
628
628
|
this.#update_range_for_deleted(entry_index);
|
|
629
629
|
|
|
@@ -636,7 +636,7 @@ export class HashMap {
|
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
// perform secondary hashing
|
|
639
|
-
bin_index = generate_next_linear_congruential_index(bin_index, this
|
|
639
|
+
bin_index = generate_next_linear_congruential_index(bin_index, this.__bin_count_mask);
|
|
640
640
|
|
|
641
641
|
}
|
|
642
642
|
}
|
|
@@ -650,9 +650,9 @@ export class HashMap {
|
|
|
650
650
|
verifyHashes(callback, thisArg) {
|
|
651
651
|
let all_hashes_valid = true;
|
|
652
652
|
|
|
653
|
-
const count = this
|
|
653
|
+
const count = this.__bin_count;
|
|
654
654
|
for (let j = 0; j < count; j++) {
|
|
655
|
-
const bin = this
|
|
655
|
+
const bin = this.__bins[j];
|
|
656
656
|
|
|
657
657
|
if (bin <= BIN_RESERVED_VALUE_DELETED) {
|
|
658
658
|
// unoccupied
|
|
@@ -662,7 +662,7 @@ export class HashMap {
|
|
|
662
662
|
/**
|
|
663
663
|
* @type {HashMapEntry<K,V>}
|
|
664
664
|
*/
|
|
665
|
-
const entry = this
|
|
665
|
+
const entry = this.__entries[bin - ENTRY_BASE];
|
|
666
666
|
|
|
667
667
|
//check hash
|
|
668
668
|
const raw_hash = this.#build_key_hash(entry.key);
|
|
@@ -679,7 +679,7 @@ export class HashMap {
|
|
|
679
679
|
}
|
|
680
680
|
|
|
681
681
|
#grow() {
|
|
682
|
-
this.#setBinCount(this
|
|
682
|
+
this.#setBinCount(this.__entries_allocated_count * 2);
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
|
|
@@ -687,17 +687,17 @@ export class HashMap {
|
|
|
687
687
|
* Rebuild table, useful for when table is resized
|
|
688
688
|
*/
|
|
689
689
|
rebuild() {
|
|
690
|
-
const entries_bound = this
|
|
691
|
-
const entries = this
|
|
690
|
+
const entries_bound = this.__entries_bound;
|
|
691
|
+
const entries = this.__entries;
|
|
692
692
|
|
|
693
693
|
// reset all bins
|
|
694
|
-
const bins = this
|
|
694
|
+
const bins = this.__bins;
|
|
695
695
|
bins.fill(BIN_RESERVED_VALUE_EMPTY);
|
|
696
696
|
|
|
697
697
|
let written_entries = 0;
|
|
698
698
|
|
|
699
699
|
for (
|
|
700
|
-
let existing_entry_index = this
|
|
700
|
+
let existing_entry_index = this.__entries_start;
|
|
701
701
|
existing_entry_index < entries_bound;
|
|
702
702
|
existing_entry_index++
|
|
703
703
|
) {
|
|
@@ -715,11 +715,15 @@ export class HashMap {
|
|
|
715
715
|
|
|
716
716
|
if (new_index !== existing_entry_index) {
|
|
717
717
|
// move entries to the new position, compacting holes
|
|
718
|
-
|
|
718
|
+
const temp = entries[new_index];
|
|
719
|
+
|
|
720
|
+
entries[new_index] = entries[existing_entry_index];
|
|
721
|
+
entries[existing_entry_index] = temp;
|
|
719
722
|
}
|
|
720
723
|
|
|
721
|
-
let bin_index = this
|
|
724
|
+
let bin_index = this.compute_bin_index(hash);
|
|
722
725
|
|
|
726
|
+
// search for place for the entry
|
|
723
727
|
for (; ;) {
|
|
724
728
|
const bin = bins[bin_index];
|
|
725
729
|
|
|
@@ -730,22 +734,22 @@ export class HashMap {
|
|
|
730
734
|
}
|
|
731
735
|
|
|
732
736
|
// perform secondary hashing
|
|
733
|
-
bin_index = generate_next_linear_congruential_index(bin_index, this
|
|
737
|
+
bin_index = generate_next_linear_congruential_index(bin_index, this.__bin_count_mask);
|
|
734
738
|
|
|
735
739
|
}
|
|
736
740
|
}
|
|
737
741
|
|
|
738
|
-
assert.equal(written_entries, this
|
|
742
|
+
assert.equal(written_entries, this.__size, `live entries(=${written_entries}) should match size(=${this.__size})`);
|
|
739
743
|
|
|
740
|
-
this
|
|
741
|
-
this
|
|
742
|
-
this
|
|
744
|
+
this.__entries_start = 0;
|
|
745
|
+
this.__entries_bound = this.__size;
|
|
746
|
+
this.__version++;
|
|
743
747
|
}
|
|
744
748
|
|
|
745
749
|
#count_live_entities() {
|
|
746
750
|
let count = 0;
|
|
747
|
-
for (let i = this
|
|
748
|
-
const entry = this
|
|
751
|
+
for (let i = this.__entries_start; i < this.__entries_bound; i++) {
|
|
752
|
+
const entry = this.__entries[i];
|
|
749
753
|
|
|
750
754
|
if (entry.hash !== RESERVED_HASH) {
|
|
751
755
|
count++;
|
|
@@ -762,13 +766,13 @@ export class HashMap {
|
|
|
762
766
|
forEach(callback, thisArg) {
|
|
763
767
|
assert.isFunction(callback, 'callback');
|
|
764
768
|
|
|
765
|
-
const count = this
|
|
766
|
-
const entries = this
|
|
767
|
-
const bins = this
|
|
768
|
-
const start_version = this
|
|
769
|
+
const count = this.__bin_count;
|
|
770
|
+
const entries = this.__entries;
|
|
771
|
+
const bins = this.__bins;
|
|
772
|
+
const start_version = this.__version;
|
|
769
773
|
|
|
770
774
|
for (let j = 0; j < count; j++) {
|
|
771
|
-
assert.equal(start_version, this
|
|
775
|
+
assert.equal(start_version, this.__version, 'HashMap modified during traversal');
|
|
772
776
|
|
|
773
777
|
const bin = bins[j];
|
|
774
778
|
|
|
@@ -802,8 +806,8 @@ export class HashMap {
|
|
|
802
806
|
clear() {
|
|
803
807
|
|
|
804
808
|
// clear out all
|
|
805
|
-
const bins = this
|
|
806
|
-
const count = this
|
|
809
|
+
const bins = this.__bins;
|
|
810
|
+
const count = this.__bin_count;
|
|
807
811
|
|
|
808
812
|
for (let i = 0; i < count; i++) {
|
|
809
813
|
const bin = bins[i];
|
|
@@ -814,7 +818,7 @@ export class HashMap {
|
|
|
814
818
|
// occupied, move to deleted
|
|
815
819
|
const entry_index = bin - ENTRY_BASE;
|
|
816
820
|
|
|
817
|
-
this.#deallocate(this
|
|
821
|
+
this.#deallocate(this.__entries[entry_index]);
|
|
818
822
|
}
|
|
819
823
|
|
|
820
824
|
// mark as empty
|
|
@@ -824,23 +828,23 @@ export class HashMap {
|
|
|
824
828
|
|
|
825
829
|
}
|
|
826
830
|
|
|
827
|
-
this
|
|
831
|
+
this.__size = 0;
|
|
828
832
|
|
|
829
|
-
this
|
|
830
|
-
this
|
|
833
|
+
this.__entries_start = 0;
|
|
834
|
+
this.__entries_bound = 0;
|
|
831
835
|
}
|
|
832
836
|
|
|
833
837
|
* [Symbol.iterator]() {
|
|
834
838
|
|
|
835
|
-
const count = this
|
|
839
|
+
const count = this.__bin_count;
|
|
836
840
|
|
|
837
|
-
const bins = this
|
|
838
|
-
const entries = this
|
|
841
|
+
const bins = this.__bins;
|
|
842
|
+
const entries = this.__entries;
|
|
839
843
|
|
|
840
|
-
const start_version = this
|
|
844
|
+
const start_version = this.__version;
|
|
841
845
|
|
|
842
846
|
for (let j = 0; j < count; j++) {
|
|
843
|
-
assert.equal(start_version, this
|
|
847
|
+
assert.equal(start_version, this.__version, 'HashMap modified during traversal');
|
|
844
848
|
|
|
845
849
|
const bin = bins[j];
|
|
846
850
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ManagedTexture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/material/manager/ManagedTexture.js"],"names":[],"mappings":"AAAA;CAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextureManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/material/manager/TextureManager.js"],"names":[],"mappings":"AAAA;CAEC"}
|