00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <mxflib/system.h>
00034
00035 namespace mxflib
00036 {
00037
00038
00039
00040 inline void PutU8(UInt8 x, unsigned char *dest) { *dest=(x); }
00041 inline void PutU16(UInt16 Data, unsigned char *Dest) { PutU8(Data >> 8, Dest); PutU8(Data & 0xff, &Dest[1]); }
00042 inline void PutU32(UInt32 Data, unsigned char *Dest) { PutU16(Data >> 16, Dest); PutU16(Data & 0xffff, &Dest[2]); }
00043 inline void PutU64(UInt64 Data, unsigned char *Dest) { PutU32((UInt32)(Data >> 32), Dest);
00044 PutU32((UInt32)Data & 0xffffffff, &Dest[4]); }
00045
00046
00047
00048
00049 inline void PutI8(Int8 x, unsigned char *dest) { PutU8((UInt8)x,dest); }
00050 inline void PutI16(Int16 x, unsigned char *dest) { PutU16((UInt16)x,dest); }
00051 inline void PutI32(Int32 x, unsigned char *dest) { PutU32((UInt32)x,dest); }
00052 inline void PutI64(Int64 x, unsigned char *dest) { PutU64((UInt64)x,dest); }
00053
00054
00055
00056
00057 inline UInt8 GetU8(const unsigned char *src) { return (UInt8) *src; }
00058 inline UInt16 GetU16(const unsigned char *src) { return (GetU8(src) << 8) | GetU8(&src[1]); }
00059 inline UInt32 GetU32(const unsigned char *src) { return (GetU16(src) << 16) | GetU16(&src[2]); }
00060 inline UInt64 GetU64(const unsigned char *src) { return (((UInt64)GetU32(src)) << 32) | (GetU32(&src[4])); }
00061
00062
00063
00064
00065 inline Int8 GetI8(const unsigned char *src) { return (Int8)GetU8(src); }
00066 inline Int16 GetI16(const unsigned char *src) { return (Int16)GetU16(src); }
00067 inline Int32 GetI32(const unsigned char *src) { return (Int32)GetU32(src); }
00068 inline Int64 GetI64(const unsigned char *src) { return (Int64)GetU64(src); }
00069
00070
00071
00072
00073 inline void PutU8_LE(UInt8 x, unsigned char *dest) { *dest=(x); }
00074 inline void PutU16_LE(UInt16 Data, unsigned char *Dest) { PutU8_LE(Data & 0xff, Dest); PutU8_LE(Data >> 8, &Dest[1]); }
00075 inline void PutU32_LE(UInt32 Data, unsigned char *Dest) { PutU16_LE(Data & 0xffff, Dest); PutU16_LE(Data >> 16, &Dest[2]); }
00076 inline void PutU64_LE(UInt64 Data, unsigned char *Dest) { PutU32_LE((UInt32)(Data & 0xffffffff), Dest);
00077 PutU32_LE((UInt32)(Data >> 32), &Dest[4]); }
00078
00079
00080
00081
00082 inline void PutI8_LE(Int8 x, unsigned char *dest) { PutU8_LE((UInt8)x,dest); }
00083 inline void PutI16_LE(Int16 x, unsigned char *dest) { PutU16_LE((UInt16)x,dest); }
00084 inline void PutI32_LE(Int32 x, unsigned char *dest) { PutU32_LE((UInt32)x,dest); }
00085 inline void PutI64_LE(Int64 x, unsigned char *dest) { PutU64_LE((UInt64)x,dest); }
00086
00087
00088
00089
00090 inline UInt8 GetU8_LE(const unsigned char *src) { return (UInt8) *src; }
00091 inline UInt16 GetU16_LE(const unsigned char *src) { return GetU8_LE(src) | (GetU8_LE(&src[1]) << 8); }
00092 inline UInt32 GetU32_LE(const unsigned char *src) { return GetU16_LE(src) | (GetU16_LE(&src[2]) << 16); }
00093 inline UInt64 GetU64_LE(const unsigned char *src) { return GetU32_LE(src) | ((UInt64)(GetU32_LE(&src[4])) << 32); }
00094
00095
00096
00097
00098 inline Int8 GetI8_LE(const unsigned char *src) { return (Int8)GetU8_LE(src); }
00099 inline Int16 GetI16_LE(const unsigned char *src) { return (Int16)GetU16_LE(src); }
00100 inline Int32 GetI32_LE(const unsigned char *src) { return (Int32)GetU32_LE(src); }
00101 inline Int64 GetI64_LE(const unsigned char *src) { return (Int64)GetU64_LE(src); }
00102 }
00103
00104