encoder.js
function encodeArray_PRIM_REPEATED( encoder, data ) {

	//
	// Repeated Primitive Array (PRIM_REPEATED)
	//
	// .......  .   + Signature ID
	// 0111100 [LN]     [16-bit]
	//

	encoder.counters.arr_prim_repeated+=1;
	encoder.log(LOG.ARR, "array.prim.repeated, len="+data.length+
		", peek="+data[0]);

	if (data.length < UINT16_MAX) { // 16-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.PRIM_REPEATED | NUMTYPE_LN.UINT16 ) );
		encoder.stream16.write( pack2b( data.length, false ) );
		encoder.counters.arr_hdr+=3;
	} else { // 32-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.PRIM_REPEATED | NUMTYPE_LN.UINT32 ) );
		encoder.stream32.write( pack4b( data.length, false ) );
		encoder.counters.arr_hdr+=5;
	}

	// Encode the short array
	encodePrimitive( encoder, data[0] );

}
function encodeArray_PRIM_REPEATED( encoder, data ) {

	//
	// Repeated Primitive Array (PRIM_REPEATED)
	//
	// .......  .   + Signature ID
	// 0111100 [LN]     [16-bit]
	//

	encoder.counters.arr_prim_repeated+=1;
	encoder.log(LOG.ARR, "array.prim.repeated, len="+data.length+
		", peek="+data[0]);

	if (data.length < UINT16_MAX) { // 16-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.PRIM_REPEATED | NUMTYPE_LN.UINT16 ) );
		encoder.stream16.write( pack2b( data.length, false ) );
		encoder.counters.arr_hdr+=3;
	} else { // 32-bit length prefix
		encoder.stream8.write( pack1b( ARR_OP.PRIM_REPEATED | NUMTYPE_LN.UINT32 ) );
		encoder.stream32.write( pack4b( data.length, false ) );
		encoder.counters.arr_hdr+=5;
	}

	// Encode the short array
	encodePrimitive( encoder, data[0] );

}
function encodeArray_PRIM_REPEATED ( encoder , data ) { // // Repeated Primitive Array (PRIM_REPEATED) // // .......  .   + Signature ID // 0111100 [LN]     [16-bit] // encoder . counters . arr_prim_repeated += 1 ; encoder . log ( LOG . ARR , "array.prim.repeated, len=" + data . length + ", peek=" + data [ 0 ] ) ; if ( data . length < UINT16_MAX ) { // 16-bit length prefix encoder . stream8 . write ( pack1b ( ARR_OP . PRIM_REPEATED | NUMTYPE_LN . UINT16 ) ) ; encoder . stream16 . write ( pack2b ( data . length , false ) ) ; encoder . counters . arr_hdr += 3 ; } else { // 32-bit length prefix encoder . stream8 . write ( pack1b ( ARR_OP . PRIM_REPEATED | NUMTYPE_LN . UINT32 ) ) ; encoder . stream32 . write ( pack4b ( data . length , false ) ) ; encoder . counters . arr_hdr += 5 ; } // Encode the short array encodePrimitive ( encoder , data [ 0 ] ) ; }
Encode array data as one repeated chunk
Encode array data as one repeated chunk