Showing the changes to codec/decoder (1 of 4 files). Show all
Unified · Split
| @@ -1,92 +0,0 @@ | |||
| 1 | /*! | ||
| 2 | * \copy | ||
| 3 | * Copyright (c) 2013, Cisco Systems | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * | ||
| 13 | * * Redistributions in binary form must reproduce the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer in | ||
| 15 | * the documentation and/or other materials provided with the | ||
| 16 | * distribution. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 24 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| 28 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 29 | * POSSIBILITY OF SUCH DAMAGE. | ||
| 30 | * | ||
| 31 | */ | ||
| 32 | |||
| 33 | #ifndef ___LD_ST_MACROS___ | ||
| 34 | #define ___LD_ST_MACROS___ | ||
| 35 | |||
| 36 | #include "typedefs.h" | ||
| 37 | |||
| 38 | #ifdef __GNUC__ | ||
| 39 | |||
| 40 | struct tagUnaligned_64 { | ||
| 41 | uint64_t l; | ||
| 42 | } __attribute__ ((packed)); | ||
| 43 | struct tagUnaligned_32 { | ||
| 44 | uint32_t l; | ||
| 45 | } __attribute__ ((packed)); | ||
| 46 | struct tagUnaligned_16 { | ||
| 47 | uint16_t l; | ||
| 48 | } __attribute__ ((packed)); | ||
| 49 | |||
| 50 | #define LD16(a) (((struct tagUnaligned_16 *) (a))->l) | ||
| 51 | #define LD32(a) (((struct tagUnaligned_32 *) (a))->l) | ||
| 52 | #define LD64(a) (((struct tagUnaligned_64 *) (a))->l) | ||
| 53 | //#define _USE_STRUCT_INT_CVT | ||
| 54 | // #ifdef _USE_STRUCT_INT_CVT | ||
| 55 | #define ST16(a, b) (((struct tagUnaligned_16 *) (a))->l) = (b) | ||
| 56 | #define ST32(a, b) (((struct tagUnaligned_32 *) (a))->l) = (b) | ||
| 57 | #define ST64(a, b) (((struct tagUnaligned_64 *) (a))->l) = (b) | ||
| 58 | // #else | ||
| 59 | // inline void_t __ST16(void_t *dst, uint16_t v) { memcpy(dst, &v, 2); } | ||
| 60 | // inline void_t __ST32(void_t *dst, uint32_t v) { memcpy(dst, &v, 4); } | ||
| 61 | //inline void_t __ST64(void_t *dst, uint64_t v) { memcpy(dst, &v, 8); } | ||
| 62 | // #endif | ||
| 63 | |||
| 64 | #else | ||
| 65 | |||
| 66 | //#define INTD16(a) (*((int16_t*)(a))) | ||
| 67 | //#define INTD32(a) (*((int32_t*)(a))) | ||
| 68 | //#define INTD64(a) (*((int64_t*)(a))) | ||
| 69 | |||
| 70 | #define LD16(a) (*((uint16_t*)(a))) | ||
| 71 | #define LD32(a) (*((uint32_t*)(a))) | ||
| 72 | #define LD64(a) (*((uint64_t*)(a))) | ||
| 73 | |||
| 74 | #define ST16(a, b) *((uint16_t*)(a)) = (b) | ||
| 75 | #define ST32(a, b) *((uint32_t*)(a)) = (b) | ||
| 76 | #define ST64(a, b) *((uint64_t*)(a)) = (b) | ||
| 77 | |||
| 78 | #endif /* !__GNUC__ */ | ||
| 79 | |||
| 80 | #ifndef INTD16 | ||
| 81 | #define INTD16 LD16 | ||
| 82 | #endif//INTD16 | ||
| 83 | |||
| 84 | #ifndef INTD32 | ||
| 85 | #define INTD32 LD32 | ||
| 86 | #endif//INTD32 | ||
| 87 | |||
| 88 | #ifndef INTD64 | ||
| 89 | #define INTD64 LD64 | ||
| 90 | #endif//INTD64 | ||
| 91 | |||
| 92 | #endif//___LD_ST_MACROS___ | ||