@typeberry/convert 0.1.2-b99f2bee → 0.1.2-ef67dce
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/index.js +18 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4695,8 +4695,8 @@ function print(level, levelAndName, strings, data) {
|
|
|
4695
4695
|
return;
|
|
4696
4696
|
}
|
|
4697
4697
|
const lvlText = Level[level].padEnd(5);
|
|
4698
|
-
const val = strings.map((v, idx) => `${v}${data[idx]}`);
|
|
4699
|
-
const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
|
|
4698
|
+
const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
|
|
4699
|
+
const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
|
|
4700
4700
|
if (level === Level.WARN) {
|
|
4701
4701
|
console.warn(msg);
|
|
4702
4702
|
}
|
|
@@ -17473,6 +17473,17 @@ class page_range_PageRange {
|
|
|
17473
17473
|
}
|
|
17474
17474
|
return new page_range_PageRange(start, length);
|
|
17475
17475
|
}
|
|
17476
|
+
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
17477
|
+
isWrapped() {
|
|
17478
|
+
return this.start >= this.end && !this.isEmpty();
|
|
17479
|
+
}
|
|
17480
|
+
/** Checks if given page number is within the range */
|
|
17481
|
+
isInRange(page) {
|
|
17482
|
+
if (this.isWrapped()) {
|
|
17483
|
+
return page >= this.start || page < this.end;
|
|
17484
|
+
}
|
|
17485
|
+
return page >= this.start && page < this.end;
|
|
17486
|
+
}
|
|
17476
17487
|
/** Checks if a range is empty (`length === 0`) */
|
|
17477
17488
|
isEmpty() {
|
|
17478
17489
|
return this.length === 0;
|
|
@@ -17852,10 +17863,11 @@ class memory_builder_MemoryBuilder {
|
|
|
17852
17863
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
17853
17864
|
`;
|
|
17854
17865
|
this.ensureNotFinalized();
|
|
17855
|
-
const
|
|
17856
|
-
const
|
|
17857
|
-
|
|
17858
|
-
|
|
17866
|
+
const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
17867
|
+
const heapPagesRange = PageRange.fromMemoryRange(heapRange);
|
|
17868
|
+
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
17869
|
+
for (const pageNumber of initializedPageNumbers) {
|
|
17870
|
+
if (heapPagesRange.isInRange(pageNumber)) {
|
|
17859
17871
|
throw new IncorrectSbrkIndex();
|
|
17860
17872
|
}
|
|
17861
17873
|
}
|