ref: 55b3ec0bab55921f5c35ddec92de4742aa0ee346
dir: /codec/common/inc/ls_defines.h/
/*! * \copy * Copyright (c) 2013, Cisco Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #ifndef ___LD_ST_MACROS___ #define ___LD_ST_MACROS___ #include "typedefs.h" #ifdef __arm64__ #define LD16(a) (((uint8_t*)(a))[0] | ((uint8_t*)(a))[1]<<8) #define LD32(a) (((uint8_t*)(a))[0] | ((uint8_t*)(a))[1]<<8 | ((uint8_t*)(a))[2]<<16 | ((uint8_t*)(a))[3]<<24) #define LD64(a) (((uint8_t*)(a))[0] | ((uint8_t*)(a))[1]<<8 | ((uint8_t*)(a))[2]<<16 | ((uint8_t*)(a))[3]<<24 | (uvlong)((uint8_t*)(a))[4]<<32 | (uvlong)((uint8_t*)(a))[5]<<40 | (uvlong)((uint8_t*)(a))[6]<<48 | (uvlong)((uint8_t*)(a))[7]<<56) #define ST16(a, b) do{ uint16_t *p = (void*)(a); *p = (b); }while(0) #define ST32(a, b) do{ uint32_t *p = (void*)(a); *p = (b); }while(0) #define ST64(a, b) do{ uint64_t *p = (void*)(a); *p = (b); }while(0) #else #define LD16(a) (*((uint16_t*)(a))) #define LD32(a) (*((uint32_t*)(a))) #define LD64(a) (*((uint64_t*)(a))) #define ST16(a, b) *((uint16_t*)(a)) = (b) #define ST32(a, b) *((uint32_t*)(a)) = (b) #define ST64(a, b) *((uint64_t*)(a)) = (b) #endif #define LD16A2 LD16 #define LD32A2 LD32 #define LD32A4 LD32 #define LD64A2 LD64 #define LD64A4 LD64 #define LD64A8 LD64 #define ST16A2 ST16 #define ST32A2 ST32 #define ST32A4 ST32 #define ST64A2 ST64 #define ST64A4 ST64 #define ST64A8 ST64 #ifndef INTD16 #define INTD16 LD16 #endif//INTD16 #ifndef INTD32 #define INTD32 LD32 #endif//INTD32 #ifndef INTD64 #define INTD64 LD64 #endif//INTD64 #endif//___LD_ST_MACROS___