ref: 37423d414836f735a91d3dec17c1370607938401
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"
#pragma pack on
struct tagUnaligned_64 {
uint64_t l;
};
struct tagUnaligned_32 {
uint32_t l;
};
struct tagUnaligned_16 {
uint16_t l;
};
#pragma pack off
#define LD16(a) (((struct tagUnaligned_16 *) (a))->l)
#define LD32(a) (((struct tagUnaligned_32 *) (a))->l)
#define LD64(a) (((struct tagUnaligned_64 *) (a))->l)
#define STRUCTA(size, align) struct tagUnaligned_##size##_##align {\
uint##size##_t l; \
}
STRUCTA (16, 2);
STRUCTA (32, 2);
STRUCTA (32, 4);
STRUCTA (64, 2);
STRUCTA (64, 4);
STRUCTA (64, 8);
#define ST16(a, b) (((struct tagUnaligned_16 *) (a))->l) = (b)
#define ST32(a, b) (((struct tagUnaligned_32 *) (a))->l) = (b)
#define ST64(a, b) (((struct tagUnaligned_64 *) (a))->l) = (b)
#define LDA(a, size, align) (((struct tagUnaligned_##size##_##align *) (a))->l)
#define STA(a, b, size, align) (((struct tagUnaligned_##size##_##align *) (a))->l) = (b)
#define LD16A2(a) LDA(a, 16, 2)
#define LD32A2(a) LDA(a, 32, 2)
#define LD32A4(a) LDA(a, 32, 4)
#define LD64A2(a) LDA(a, 64, 2)
#define LD64A4(a) LDA(a, 64, 4)
#define LD64A8(a) LDA(a, 64, 8)
#define ST16A2(a, b) STA(a, b, 16, 2)
#define ST32A2(a, b) STA(a, b, 32, 2)
#define ST32A4(a, b) STA(a, b, 32, 4)
#define ST64A2(a, b) STA(a, b, 64, 2)
#define ST64A4(a, b) STA(a, b, 64, 4)
#define ST64A8(a, b) STA(a, b, 64, 8)
#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___