mirror of
https://github.com/JonasunderscoreJones/api.jonasjones.dev.git
synced 2025-10-23 20:19:19 +02:00
Initial commit (by create-cloudflare CLI)
This commit is contained in:
commit
58a42872a0
1745 changed files with 741893 additions and 0 deletions
44
node_modules/capnp-ts/src/serialization/object-size.js
generated
vendored
Normal file
44
node_modules/capnp-ts/src/serialization/object-size.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @author jdiaz5513
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.padToWord = exports.getWordLength = exports.getDataWordLength = exports.getByteLength = exports.ObjectSize = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const debug_1 = tslib_1.__importDefault(require("debug"));
|
||||
const _ = tslib_1.__importStar(require("../util"));
|
||||
const trace = debug_1.default("capnp:object-size");
|
||||
trace("load");
|
||||
/**
|
||||
* A simple object that describes the size of a struct.
|
||||
*
|
||||
* @export
|
||||
* @class ObjectSize
|
||||
*/
|
||||
class ObjectSize {
|
||||
constructor(dataByteLength, pointerCount) {
|
||||
this.dataByteLength = dataByteLength;
|
||||
this.pointerLength = pointerCount;
|
||||
}
|
||||
toString() {
|
||||
return _.format("ObjectSize_dw:%d,pc:%d", getDataWordLength(this), this.pointerLength);
|
||||
}
|
||||
}
|
||||
exports.ObjectSize = ObjectSize;
|
||||
function getByteLength(o) {
|
||||
return o.dataByteLength + o.pointerLength * 8;
|
||||
}
|
||||
exports.getByteLength = getByteLength;
|
||||
function getDataWordLength(o) {
|
||||
return o.dataByteLength / 8;
|
||||
}
|
||||
exports.getDataWordLength = getDataWordLength;
|
||||
function getWordLength(o) {
|
||||
return o.dataByteLength / 8 + o.pointerLength;
|
||||
}
|
||||
exports.getWordLength = getWordLength;
|
||||
function padToWord(o) {
|
||||
return new ObjectSize(_.padToWord(o.dataByteLength), o.pointerLength);
|
||||
}
|
||||
exports.padToWord = padToWord;
|
||||
//# sourceMappingURL=object-size.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue