public void u16(RawBitWriter <TMemory> b, u16 value) { while (value >= 0b10000000) { b.u8Raw((u8)(value | 0b10000000)); value >>= 7; } b.u8Raw((u8)value); }
public void u32(RawBitWriter <TMemory> b, u32 value) // 1. trying to use generic method or class with call for inline and optimize with only interface constraint losses great of performance // 2. passing instance of class buffer by `in` slows down by 10 // 3. per call instance of holder struct also losts 10 percentage of performance (not sure if share per thread) { // TODO: how to use CPU parallelism here ? unrol loop? couple of temporal variables? // TODO: mere 8 and 8 into one 16? write special handling code for 8 and 16 coming from outside? // oneliner version to use if need copy paste while (value >= 0b10000000) { b.u8Raw((u8)(value | 0b10000000)); value >>= 7; } b.u8Raw((u8)value); }
public void u8(RawBitWriter <TMemory> b, u8 value) => b.u8Raw(value);