Esempio n. 1
0
        public float PeekFloat(bool useHalfPrecision = true)
        {
            if (useHalfPrecision)
            {
                return(HalfPrecision.Decompress((ushort)Peek(16)));
            }

            var union = new Utils.FloatUintUnion {
                uint32 = Peek(32)
            };

            return(union.single);
        }
Esempio n. 2
0
        public BitBuffer AddFloat(float value, bool useHalfPrecision = true)
        {
            if (useHalfPrecision)
            {
                Add(16, HalfPrecision.Compress(value));
            }
            else
            {
                var union = new Utils.FloatUintUnion {
                    single = value
                };
                Add(32, union.uint32);
            }

            return(this);
        }