Ejemplo n.º 1
0
            public static u64 u64Decode(IBitBufferReader self)
            {
                bool lastbit = false;
                u8   fib     = 0;
                u64  result  = 0;
                bool sub     = false;

                while (true) // TODO: prevent loop with sane check
                {
                    // TODO: optimize
                    if (self.b())
                    {
                        if (lastbit)
                        {
                            break;
                        }

                        result += u64Lookup[fib];
                        // if (!sub)
                        // {
                        //     result -= 1;
                        //     sub = false;
                        // }

                        lastbit = true;
                    }
                    else
                    {
                        lastbit = false;
                    }

                    fib++;
                }

                return(result - 1);
            }
Ejemplo n.º 2
0
 public static f32 f32Half(this IBitBufferReader self)
 =>
 HalfPrecision.Decompress((u16)self.u32(16));