typedef unsigned char BOOLEAN;
typedef unsigned char INT8U; /* Unsigned 8 bit quantity */
typedef signed char INT8S; /* Signed 8 bit quantity */
typedef unsigned short INT16U; /* Signed 16 bit quantity */
typedef signed short INT16S; /* Unsigned 32 bit quantity */
typedef unsigned int INT32U; /* Unsigned 32 bit quantity */
typedef signed int INT32S; /* Signed 32 bit quantity */
typedef float FP32; /* Single precision floating point */
typedef double FP64; /* Double precision floating point */typedef union {
INT16U hword;
#ifdef __BIG_ENDIAN
struct {
INT8U high;
INT8U low;
} bytes;
#else
struct {
INT8U low;
INT8U high;
} bytes;
#endif
} HWORD_UNION;分数不多,请高手帮忙
typedef unsigned char INT8U; /* Unsigned 8 bit quantity */
typedef signed char INT8S; /* Signed 8 bit quantity */
typedef unsigned short INT16U; /* Signed 16 bit quantity */
typedef signed short INT16S; /* Unsigned 32 bit quantity */
typedef unsigned int INT32U; /* Unsigned 32 bit quantity */
typedef signed int INT32S; /* Signed 32 bit quantity */
typedef float FP32; /* Single precision floating point */
typedef double FP64; /* Double precision floating point */typedef union {
INT16U hword;
#ifdef __BIG_ENDIAN
struct {
INT8U high;
INT8U low;
} bytes;
#else
struct {
INT8U low;
INT8U high;
} bytes;
#endif
} HWORD_UNION;分数不多,请高手帮忙
Handle: Integer;
Mode: Word;
Flags: Word;
case Byte of
0: (RecSize: Cardinal); // files of record
1: (BufSize: Cardinal; // text files
BufPos: Cardinal;
BufEnd: Cardinal;
BufPtr: PAnsiChar;
OpenFunc: Pointer;
InOutFunc: Pointer;
FlushFunc: Pointer;
CloseFunc: Pointer;
UserData: array[1..32] of Byte;
{$IFNDEF UNICODE}
Name: array[0..259] of AnsiChar;
{$ELSE}
Name: array[0..259] of WideChar;
{$ENDIF}
);
end;
HWORD_UNION = Cardinal;var
V: HWORD_UNION;
begin
V := $12345678;
LongRec(V).Bytes[0]...[3]
LongRec(V).Words[0]...[1]
LongRec(V).hi or lo
end;
麻烦高手针对这个union转换到delphi给指点下,先谢谢啦!
copy过来,学习一下。 TWordRec = packed record
case Integer of
0: (AWord: Word);
1: (
{$IFDEF BIG_ENDIAN}
HighByte: Byte;
LowByte: Byte;
{$ELSE}
LowByte: Byte;
HighByte: Byte;
{$ENDIF}
);
end;