public unsafe void writeints(int len, int pos, byte *buf) { int old_pos = BitLength; int start = old_pos / 8; int start1 = pos / 8; int end = (old_pos + len) / 8; int end1 = (pos + len) / 8; flush(); byte start_val = old_pos % 8 != 0 ? buffer[start] : (byte)0; fixed(byte *buf1 = &buffer[0]) { if (old_pos % 8 != 0) { crc16_m = Crc16.Substract(crc16_m, 0, 1); } crc16_m = Crc16.ComputeChecksum(crc16_m, buf + start1, end - start); AudioSamples.MemCpy(buf1 + start, buf + start1, end - start); buf1[start] |= start_val; } buf_ptr_m = end; if ((old_pos + len) % 8 != 0) { writebits((old_pos + len) % 8, buf[end1] >> (8 - ((old_pos + len) % 8))); } }
public unsafe void writeints(int len, int pos, byte *buf) { int old_pos = BitLength; int start = old_pos / 8; int start1 = pos / 8; int end = (old_pos + len) / 8; int end1 = (pos + len) / 8; flush(); byte start_val = old_pos % 8 != 0 ? buffer[start] : (byte)0; fixed(byte *buf1 = &buffer[0]) AudioSamples.MemCpy(buf1 + start, buf + start1, end - start); buffer[start] |= start_val; buf_ptr = end; if ((old_pos + len) % 8 != 0) { writebits((old_pos + len) % 8, buf[end1] >> (8 - ((old_pos + len) % 8))); } }