/// <summary> /// Restore a <seealso cref="ForUtil"/> from a <seealso cref="DataInput"/>. /// </summary> public ForUtil(DataInput @in) { int packedIntsVersion = @in.ReadVInt(); PackedInts.CheckVersion(packedIntsVersion); EncodedSizes = new int[33]; Encoders = new PackedInts.Encoder[33]; Decoders = new PackedInts.Decoder[33]; Iterations = new int[33]; for (int bpv = 1; bpv <= 32; ++bpv) { var code = @in.ReadVInt(); var formatId = (int)((uint)code >> 5); var bitsPerValue = (code & 31) + 1; PackedInts.Format format = PackedInts.Format.ById(formatId); Debug.Assert(format.IsSupported(bitsPerValue)); EncodedSizes[bpv] = EncodedSize(format, packedIntsVersion, bitsPerValue); Encoders[bpv] = PackedInts.GetEncoder(format, packedIntsVersion, bitsPerValue); Decoders[bpv] = PackedInts.GetDecoder(format, packedIntsVersion, bitsPerValue); Iterations[bpv] = ComputeIterations(Decoders[bpv]); } }