badger/tests/host_cmds_gen.c
/* Real-life packets can have embedded nuls, but just use
 * ASCII strings for these tests */
Real-life packets can have embedded nuls, but just use
ASCII strings for these tests
Real - life packets can have embedded nuls but just use ASCII strings for these tests
static void spit_packet(FILE *fout, const char s[])
{
	unsigned int base=16;
	size_t sl = strlen(s);
	unsigned ix=base;
	int16_t word=0;
	mem_write(fout, ix++, sl);
	host_mem[base] = sl;
	for (unsigned jx=0; jx<sl; jx++) {
		word = (s[jx]<<8) | (word>>8);
		if (jx&1) {
			mem_write(fout, ix++, word);
		}
	}
	if (sl&1) mem_write(fout, ix, word>>8);
	mem_close(fout, base);
}
static void spit_packet ( FILE * fout , const char s [ ] ) { unsigned int base = 16 ; size_t sl = strlen ( s ) ; unsigned ix = base ; int16_t word = 0 ; mem_write ( fout , ix ++ , sl ) ; host_mem [ base ] = sl ; for ( unsigned jx = 0 ; jx < sl ; jx ++ ) { word = ( s [ jx ] << 8 ) | ( word >> 8 ) ; if ( jx & 1 ) { mem_write ( fout , ix ++ , word ) ; } } if ( sl & 1 ) mem_write ( fout , ix , word >> 8 ) ; mem_close ( fout , base ) ; }
Real-life packets can have embedded nuls, but just use
 ASCII strings for these tests
Real - life packets can have embedded nuls but just use ASCII strings for these tests
// Little-endian; see big_endian parameter in test_tx_mac.