예제 #1
0
        public List <double> read_double_list()
        {
            List <double> double_list = null;

            UInt32 sz = this.read_array_size();

            if (sz == 0)
            {
                return(new List <double>());
            }

            int len = this.reader.ReadByte();

            sz--;

            if (len != 8)
            {
                SprotoTypeSize.error("invalid intlen (" + len + ")");
            }

            double_list = new List <double>();
            UnionValue u = new UnionValue();

            for (int i = 0; i < sz / 8; i++)
            {
                u.integer_v = this.read_uint64();
                double_list.Add(u.real_v);
            }
            return(double_list);
        }
예제 #2
0
        public void write_double(double v, int tag)
        {
            UnionValue u = new UnionValue();

            u.real_v = v;
            this.encode_uint64(u.integer_v);
            this.write_tag(tag, 0);
        }
예제 #3
0
        public double read_double()
        {
            UInt32 sz = this.read_dword();

            if (sz == 8)
            {
                UnionValue v = new UnionValue();
                v.integer_v = this.read_uint64();
                return(v.real_v);
            }
            else
            {
                SprotoTypeSize.error("read invalid double size (" + sz + ")");
            }
            return(0.0);
        }
예제 #4
0
        public void write_double(List <double> double_list, int tag)
        {
            if (double_list == null || double_list.Count <= 0)
            {
                return;
            }

            int size = double_list.Count * 8;

            this.fill_size(size + 1);
            this.data.WriteByte(8);
            UnionValue u = new UnionValue();

            for (int index = 0; index < double_list.Count; index++)
            {
                u.real_v = double_list[index];
                this.write_uint64(u.integer_v);
            }
            this.write_tag(tag, 0);
        }