Home | History | Annotate | Download | only in BaseMemoryLibSse2
      1 /** @file
      2   Implementation of IsZeroBuffer function.
      3 
      4   The following BaseMemoryLib instances contain the same copy of this file:
      5 
      6     BaseMemoryLib
      7     BaseMemoryLibMmx
      8     BaseMemoryLibSse2
      9     BaseMemoryLibRepStr
     10     BaseMemoryLibOptDxe
     11     BaseMemoryLibOptPei
     12     PeiMemoryLib
     13     UefiMemoryLib
     14 
     15   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
     16   This program and the accompanying materials
     17   are licensed and made available under the terms and conditions of the BSD License
     18   which accompanies this distribution.  The full text of the license may be found at
     19   http://opensource.org/licenses/bsd-license.php
     20 
     21   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     22   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     23 
     24 **/
     25 
     26 #include "MemLibInternals.h"
     27 
     28 /**
     29   Checks if the contents of a buffer are all zeros.
     30 
     31   This function checks whether the contents of a buffer are all zeros. If the
     32   contents are all zeros, return TRUE. Otherwise, return FALSE.
     33 
     34   If Length > 0 and Buffer is NULL, then ASSERT().
     35   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
     36 
     37   @param  Buffer      The pointer to the buffer to be checked.
     38   @param  Length      The size of the buffer (in bytes) to be checked.
     39 
     40   @retval TRUE        Contents of the buffer are all zeros.
     41   @retval FALSE       Contents of the buffer are not all zeros.
     42 
     43 **/
     44 BOOLEAN
     45 EFIAPI
     46 IsZeroBuffer (
     47   IN CONST VOID  *Buffer,
     48   IN UINTN       Length
     49   )
     50 {
     51   ASSERT (!(Buffer == NULL && Length > 0));
     52   ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
     53   return InternalMemIsZeroBuffer (Buffer, Length);
     54 }
     55