Lucene.Net.Index.TestBinaryDocValuesUpdates.ToBytes C# (CSharp) Method

ToBytes() static private method

static private ToBytes ( long value ) : BytesRef
value long
return BytesRef
        internal static BytesRef ToBytes(long value)
        {
            //    long orig = value;
            BytesRef bytes = new BytesRef(10); // negative longs may take 10 bytes
            while ((value & ~0x7FL) != 0L)
            {
                bytes.Bytes[bytes.Length++] = unchecked((byte)((value & 0x7FL) | 0x80L));
                value = (long)((ulong)value >> 7);
            }
            bytes.Bytes[bytes.Length++] = (byte)value;
            //    System.err.println("[" + Thread.currentThread().getName() + "] value=" + orig + ", bytes=" + bytes);
            return bytes;
        }