29 OUT VOID *DestinationBuffer,
39 volatile UINT8 *Destination8;
41 volatile UINT32 *Destination32;
42 CONST UINT32 *Source32;
43 volatile UINT64 *Destination64;
44 CONST UINT64 *Source64;
47 if ((((
UINTN)DestinationBuffer & 0x7) == 0) && (((
UINTN)SourceBuffer & 0x7) == 0) && (Length >= 8)) {
48 if (SourceBuffer > DestinationBuffer) {
49 Destination64 = (UINT64 *)DestinationBuffer;
50 Source64 = (
CONST UINT64 *)SourceBuffer;
52 *(Destination64++) = *(Source64++);
57 Destination8 = (UINT8 *)Destination64;
58 Source8 = (
CONST UINT8 *)Source64;
59 while (Length-- != 0) {
60 *(Destination8++) = *(Source8++);
62 }
else if (SourceBuffer < DestinationBuffer) {
63 Destination64 = (UINT64 *)((
UINTN)DestinationBuffer + Length);
64 Source64 = (
CONST UINT64 *)((
UINTN)SourceBuffer + Length);
70 Alignment = Length & 0x7;
72 Destination8 = (UINT8 *)Destination64;
73 Source8 = (
CONST UINT8 *)Source64;
75 while (Alignment-- != 0) {
76 *(--Destination8) = *(--Source8);
80 Destination64 = (UINT64 *)Destination8;
81 Source64 = (
CONST UINT64 *)Source8;
85 *(--Destination64) = *(--Source64);
89 }
else if ((((
UINTN)DestinationBuffer & 0x3) == 0) && (((
UINTN)SourceBuffer & 0x3) == 0) && (Length >= 4)) {
90 if (SourceBuffer > DestinationBuffer) {
91 Destination32 = (UINT32 *)DestinationBuffer;
92 Source32 = (
CONST UINT32 *)SourceBuffer;
94 *(Destination32++) = *(Source32++);
99 Destination8 = (UINT8 *)Destination32;
100 Source8 = (
CONST UINT8 *)Source32;
101 while (Length-- != 0) {
102 *(Destination8++) = *(Source8++);
104 }
else if (SourceBuffer < DestinationBuffer) {
105 Destination32 = (UINT32 *)((
UINTN)DestinationBuffer + Length);
106 Source32 = (
CONST UINT32 *)((
UINTN)SourceBuffer + Length);
112 Alignment = Length & 0x3;
113 if (Alignment != 0) {
114 Destination8 = (UINT8 *)Destination32;
115 Source8 = (
CONST UINT8 *)Source32;
117 while (Alignment-- != 0) {
118 *(--Destination8) = *(--Source8);
122 Destination32 = (UINT32 *)Destination8;
123 Source32 = (
CONST UINT32 *)Source8;
127 *(--Destination32) = *(--Source32);
132 if (SourceBuffer > DestinationBuffer) {
133 Destination8 = (UINT8 *)DestinationBuffer;
134 Source8 = (
CONST UINT8 *)SourceBuffer;
135 while (Length-- != 0) {
136 *(Destination8++) = *(Source8++);
138 }
else if (SourceBuffer < DestinationBuffer) {
139 Destination8 = (UINT8 *)DestinationBuffer + (Length - 1);
140 Source8 = (
CONST UINT8 *)SourceBuffer + (Length - 1);
141 while (Length-- != 0) {
142 *(Destination8--) = *(Source8--);
147 return DestinationBuffer;
VOID *EFIAPI InternalMemCopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)