author jdiaz5513
  import initTrace from "debug" ; import * as _ from "../util" ; const trace = initTrace ( "capnp:object-size" ) ; trace ( "load" ) ; export class export class ObjectSize { /** The number of bytes required for the data section. */ readonly dataByteLength : number ; /** The number of pointers in the object. */ readonly pointerLength : number ; constructor ( dataByteLength , pointerCount ) { this . dataByteLength = dataByteLength ; this . pointerLength = pointerCount ; } toString ( ) { return _ . format ( "ObjectSize_dw:%d,pc:%d" , getDataWordLength ( this ) , this . pointerLength ) ; } } export function getByteLength ( o ) { return o . dataByteLength + o . pointerLength * 8 ; } export function getDataWordLength ( o ) { return o . dataByteLength / 8 ; } export function getWordLength ( o ) { return o . dataByteLength / 8 + o . pointerLength ; } export function padToWord ( o ) { return new ObjectSize ( _ . padToWord ( o . dataByteLength ) , o . pointerLength ) ; }