/// <summary> /// get length info from remain /// </summary> /// <param name="lengthBitCount"></param> private void GetLengthFromRemain(LengthBitSize lengthBitCount) { //remian bit count will reduce by lengthBitCount. remainBitsCount -= (int)lengthBitCount; //the mask to get the data part of the length uint mask = (uint)((1 << ((int)lengthBitCount / 2)) - 1); //add flag part and the data part of length. length = ((remain >> remainBitsCount) & mask) + (mask + 1); //caculate the remain after getting the length remain = remain & (uint)((1 << remainBitsCount) - 1); }