xref: /isa-l/include/mem_routines.h (revision fa5b8baf84e6a18dbaad48a3fa0d1fa062ae2fe8)
16e201339SJohn Kariuki /**********************************************************************
26e201339SJohn Kariuki   Copyright(c) 2011-2018 Intel Corporation All rights reserved.
36e201339SJohn Kariuki 
46e201339SJohn Kariuki   Redistribution and use in source and binary forms, with or without
56e201339SJohn Kariuki   modification, are permitted provided that the following conditions
66e201339SJohn Kariuki   are met:
76e201339SJohn Kariuki     * Redistributions of source code must retain the above copyright
86e201339SJohn Kariuki       notice, this list of conditions and the following disclaimer.
96e201339SJohn Kariuki     * Redistributions in binary form must reproduce the above copyright
106e201339SJohn Kariuki       notice, this list of conditions and the following disclaimer in
116e201339SJohn Kariuki       the documentation and/or other materials provided with the
126e201339SJohn Kariuki       distribution.
136e201339SJohn Kariuki     * Neither the name of Intel Corporation nor the names of its
146e201339SJohn Kariuki       contributors may be used to endorse or promote products derived
156e201339SJohn Kariuki       from this software without specific prior written permission.
166e201339SJohn Kariuki 
176e201339SJohn Kariuki   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186e201339SJohn Kariuki   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196e201339SJohn Kariuki   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206e201339SJohn Kariuki   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216e201339SJohn Kariuki   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226e201339SJohn Kariuki   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236e201339SJohn Kariuki   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246e201339SJohn Kariuki   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256e201339SJohn Kariuki   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266e201339SJohn Kariuki   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276e201339SJohn Kariuki   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286e201339SJohn Kariuki **********************************************************************/
296e201339SJohn Kariuki 
306e201339SJohn Kariuki #include <stddef.h>
316e201339SJohn Kariuki 
326e201339SJohn Kariuki /**
336e201339SJohn Kariuki  *  @file mem_routines.h
346e201339SJohn Kariuki  *  @brief Interface to storage mem operations
356e201339SJohn Kariuki  *
366e201339SJohn Kariuki  *  Defines the interface for vector versions of common memory functions.
376e201339SJohn Kariuki  */
386e201339SJohn Kariuki 
396e201339SJohn Kariuki #ifndef _MEM_ROUTINES_H_
406e201339SJohn Kariuki #define _MEM_ROUTINES_H_
416e201339SJohn Kariuki 
426e201339SJohn Kariuki #ifdef __cplusplus
436e201339SJohn Kariuki extern "C" {
446e201339SJohn Kariuki #endif
456e201339SJohn Kariuki 
466e201339SJohn Kariuki /**
476e201339SJohn Kariuki  * @brief Detect if a memory region is all zero
486e201339SJohn Kariuki  *
496e201339SJohn Kariuki  * Zero detect function with optimizations for large blocks > 128 bytes
506e201339SJohn Kariuki  *
516e201339SJohn Kariuki  * @param    mem   Pointer to memory region to test
526e201339SJohn Kariuki  * @param    len   Length of region in bytes
536e201339SJohn Kariuki  * @returns  0     - region is all zeros
546e201339SJohn Kariuki  *           other - region has non zero bytes
556e201339SJohn Kariuki  */
56*fa5b8bafSMarcel Cornu int
57*fa5b8bafSMarcel Cornu isal_zero_detect(void *mem, size_t len);
586e201339SJohn Kariuki 
596e201339SJohn Kariuki #ifdef __cplusplus
606e201339SJohn Kariuki }
616e201339SJohn Kariuki #endif
626e201339SJohn Kariuki 
636e201339SJohn Kariuki #endif // _MEM_ROUTINES_H_
64