lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J C" <roamingc...@hotmail.com>
Subject IndexOutput.cs
Date Thu, 04 May 2006 04:06:44 GMT
Hi there,
I found the following lines today

i = (int) (((uint) i) >> 7);    // {{Aroush-1.9}} Is this OK?!  long to 
uint, to int conversion.

Method:public virtual void  WriteVLong(long i)
File: IndexOutput.cs

It seems to be OK regarding my experience in developing network com program:
The following is from a network transport program i developed:

protected void WriteByte(byte value)
{ ...}

public void Write(long value) {
            byte[] octets = new byte[8];
            byte len;
            long endValue = (value < 0) ? -1 : 0;
            long endSign = endValue & 0x80;

            for (len = 0; len == 0 || value != endValue || (octets[len - 1] 
& 0x80) != endSign; len++) {
                octets[len] = (byte)(value & 0xFF);
                value >>= 8;
            }

            WriteByte((byte)len); // Length
            for (int i = len - 1; i >= 0; i--) {
                WriteByte((byte)octets[i]);
            }
        }

_________________________________________________________________
Send 1c txt to other Telstra Pre-Paid Plus mobiles. Join now 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fadsfac%2Enet%2Flink%2Easp%3Fcc%3DTEL185%2E19163%2E0%26clk%3D1%26creativeID%3D29997&_t=754399967&_m=EXT


Mime
View raw message