70 lines
1.4 KiB
C
70 lines
1.4 KiB
C
|
/*++
|
||
|
|
||
|
Copyright (c) 1989 Microsoft Corporation
|
||
|
|
||
|
Module Name:
|
||
|
|
||
|
cpyuchr.h
|
||
|
|
||
|
Abstract:
|
||
|
|
||
|
A more central set of definitions for unpacking unaligned
|
||
|
data (i.e. for unbpacking bios parameter blocks).
|
||
|
|
||
|
Author:
|
||
|
|
||
|
Revision History:
|
||
|
|
||
|
--*/
|
||
|
|
||
|
#ifndef CopyUchar1
|
||
|
//
|
||
|
// The following types and macros are used to help unpack the packed and
|
||
|
// misaligned fields found in the Bios parameter block
|
||
|
//
|
||
|
|
||
|
typedef union _UCHAR1 {
|
||
|
UCHAR Uchar[1];
|
||
|
UCHAR ForceAlignment;
|
||
|
} UCHAR1, *PUCHAR1;
|
||
|
|
||
|
typedef union _UCHAR2 {
|
||
|
UCHAR Uchar[2];
|
||
|
USHORT ForceAlignment;
|
||
|
} UCHAR2, *PUCHAR2;
|
||
|
|
||
|
typedef union _UCHAR4 {
|
||
|
UCHAR Uchar[4];
|
||
|
ULONG ForceAlignment;
|
||
|
} UCHAR4, *PUCHAR4;
|
||
|
|
||
|
//
|
||
|
// This macro copies an unaligned src byte to an aligned dst byte
|
||
|
//
|
||
|
|
||
|
#define CopyUchar1(Dst,Src) { \
|
||
|
*((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// This macro copies an unaligned src word to an aligned dst word
|
||
|
//
|
||
|
|
||
|
#define CopyUchar2(Dst,Src) { \
|
||
|
*((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// This macro copies an unaligned src longword to an aligned dsr longword
|
||
|
//
|
||
|
|
||
|
#define CopyUchar4(Dst,Src) { \
|
||
|
*((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
|
||
|
}
|
||
|
|
||
|
#define CopyU4char(Dst,Src) { \
|
||
|
*((UNALIGNED UCHAR4 *)(Dst)) = *((UCHAR4 *)(Src)); \
|
||
|
}
|
||
|
|
||
|
#endif
|