EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

MdePkg/Library/BaseMemoryLib/MemLibGeneric.c

Go to the documentation of this file.
00001 
00020 #include "MemLibInternals.h"
00021 
00032 VOID *
00033 EFIAPI
00034 InternalMemSetMem16 (
00035   OUT     VOID                      *Buffer,
00036   IN      UINTN                     Length,
00037   IN      UINT16                    Value
00038   )
00039 {
00040   do {
00041     ((UINT16*)Buffer)[--Length] = Value;
00042   } while (Length != 0);
00043   return Buffer;
00044 }
00045 
00056 VOID *
00057 EFIAPI
00058 InternalMemSetMem32 (
00059   OUT     VOID                      *Buffer,
00060   IN      UINTN                     Length,
00061   IN      UINT32                    Value
00062   )
00063 {
00064   do {
00065     ((UINT32*)Buffer)[--Length] = Value;
00066   } while (Length != 0);
00067   return Buffer;
00068 }
00069 
00080 VOID *
00081 EFIAPI
00082 InternalMemSetMem64 (
00083   OUT     VOID                      *Buffer,
00084   IN      UINTN                     Length,
00085   IN      UINT64                    Value
00086   )
00087 {
00088   do {
00089     ((UINT64*)Buffer)[--Length] = Value;
00090   } while (Length != 0);
00091   return Buffer;
00092 }
00093 
00103 VOID *
00104 EFIAPI
00105 InternalMemZeroMem (
00106   OUT     VOID                      *Buffer,
00107   IN      UINTN                     Length
00108   )
00109 {
00110   return InternalMemSetMem (Buffer, Length, 0);
00111 }
00112 
00126 INTN
00127 EFIAPI
00128 InternalMemCompareMem (
00129   IN      CONST VOID                *DestinationBuffer,
00130   IN      CONST VOID                *SourceBuffer,
00131   IN      UINTN                     Length
00132   )
00133 {
00134   while ((--Length != 0) &&
00135          (*(INT8*)DestinationBuffer == *(INT8*)SourceBuffer)) {
00136     DestinationBuffer = (INT8*)DestinationBuffer + 1;
00137     SourceBuffer = (INT8*)SourceBuffer + 1;
00138   }
00139   return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer;
00140 }
00141 
00153 CONST VOID *
00154 EFIAPI
00155 InternalMemScanMem8 (
00156   IN      CONST VOID                *Buffer,
00157   IN      UINTN                     Length,
00158   IN      UINT8                     Value
00159   )
00160 {
00161   CONST UINT8                       *Pointer;
00162 
00163   Pointer = (CONST UINT8*)Buffer;
00164   do {
00165     if (*Pointer == Value) {
00166       return Pointer;
00167     }
00168     ++Pointer;
00169   } while (--Length != 0);
00170   return NULL;
00171 }
00172 
00184 CONST VOID *
00185 EFIAPI
00186 InternalMemScanMem16 (
00187   IN      CONST VOID                *Buffer,
00188   IN      UINTN                     Length,
00189   IN      UINT16                    Value
00190   )
00191 {
00192   CONST UINT16                      *Pointer;
00193 
00194   Pointer = (CONST UINT16*)Buffer;
00195   do {
00196     if (*Pointer == Value) {
00197       return Pointer;
00198     }
00199     ++Pointer;
00200   } while (--Length != 0);
00201   return NULL;
00202 }
00203 
00215 CONST VOID *
00216 EFIAPI
00217 InternalMemScanMem32 (
00218   IN      CONST VOID                *Buffer,
00219   IN      UINTN                     Length,
00220   IN      UINT32                    Value
00221   )
00222 {
00223   CONST UINT32                      *Pointer;
00224 
00225   Pointer = (CONST UINT32*)Buffer;
00226   do {
00227     if (*Pointer == Value) {
00228       return Pointer;
00229     }
00230     ++Pointer;
00231   } while (--Length != 0);
00232   return NULL;
00233 }
00234 
00246 CONST VOID *
00247 EFIAPI
00248 InternalMemScanMem64 (
00249   IN      CONST VOID                *Buffer,
00250   IN      UINTN                     Length,
00251   IN      UINT64                    Value
00252   )
00253 {
00254   CONST UINT64                      *Pointer;
00255 
00256   Pointer = (CONST UINT64*)Buffer;
00257   do {
00258     if (*Pointer == Value) {
00259       return Pointer;
00260     }
00261     ++Pointer;
00262   } while (--Length != 0);
00263   return NULL;
00264 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines