DecodeZigZag64() 개인적인 메소드

private DecodeZigZag64 ( ulong n ) : long
n ulong
리턴 long
예제 #1
0
        public void RoundTripZigZag64()
        {
            Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(0)));
            Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(1)));
            Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-1)));
            Assert.AreEqual(14927, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(14927)));
            Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-3612)));

            Assert.AreEqual(856912304801416L, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(856912304801416L)));
            Assert.AreEqual(-75123905439571256L, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L)));
        }
예제 #2
0
 public void DecodeZigZag64()
 {
     Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(0));
     Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(1));
     Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(2));
     Assert.AreEqual(-2, CodedInputStream.DecodeZigZag64(3));
     Assert.AreEqual(0x000000003FFFFFFFL, CodedInputStream.DecodeZigZag64(0x000000007FFFFFFEL));
     Assert.AreEqual(unchecked ((long)0xFFFFFFFFC0000000L), CodedInputStream.DecodeZigZag64(0x000000007FFFFFFFL));
     Assert.AreEqual(0x000000007FFFFFFFL, CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFEL));
     Assert.AreEqual(unchecked ((long)0xFFFFFFFF80000000L), CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFFL));
     Assert.AreEqual(0x7FFFFFFFFFFFFFFFL, CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFEL));
     Assert.AreEqual(unchecked ((long)0x8000000000000000L), CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFFL));
 }
예제 #3
0
 public bool ReadSInt64(ref long value)
 {
     value = CodedInputStream.DecodeZigZag64(this.ReadRawVarint64());
     return(true);
 }