예제 #1
0
파일: Primitives.cs 프로젝트: nguyenbs/as3c
        public static S24 ReadS24(byte[] buffer, uint start)
        {
            S24 result = new S24();

            result._value = (buffer[start] | (buffer[start + 1] << 8) | (buffer[start + 2] << 16));

            SetS24Sign(ref result);

            return(result);
        }
예제 #2
0
파일: Primitives.cs 프로젝트: nguyenbs/as3c
        public static S24 ReadS24(BinaryReader reader)
        {
            S24 result = new S24();

            result._value = ((reader.ReadByte()) | (reader.ReadByte() << 8) | (reader.ReadByte() << 16));

            SetS24Sign(ref result);

            return(result);
        }
예제 #3
0
파일: Primitives.cs 프로젝트: nguyenbs/as3c
        private static void SetS24Sign(ref S24 result)
        {
            if (0 != (0x800000 & result._value))
            {
                // Is there maybe a better way to do this?
                uint buf = (uint)result._value;
                buf |= 0xff000000;

                result._value = (int)buf;

                /*if (result._value < 0)
                 * {
                 *  result._value++;
                 * }*/
            }
        }
예제 #4
0
파일: Primitives.cs 프로젝트: nguyenbs/as3c
 public static void WriteS24(BinaryWriter writer, S24 value)
 {
     WriteS24(writer, (int)value);
 }