author liangqin.fan gmail class export class SizeBuffer { private buf : Uint8Array ; constructor ( size ) { this . buf = new Uint8Array ( 4 ) ; for ( let i = 0 ; i < 4 ; i ++ ) { this . buf [ i ] = ( ( size >> ( i * 8 ) ) & 0xff ) as u8 ; } } get buffer ( ) : usize { return this . buf . dataStart ; } get value ( ) : u32 { let v = 0 ; for ( let i = 3 ; i >= 0 ; i -- ) { v = ( ( this . buf [ i ] as u32 ) << ( i * 8 ) ) | v ; } return v ; } }