| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 #ifndef VP8_COMMON_COMMON_H_ | 12 #ifndef VP8_COMMON_COMMON_H_ |
| 13 #define VP8_COMMON_COMMON_H_ | 13 #define VP8_COMMON_COMMON_H_ |
| 14 | 14 |
| 15 #include <assert.h> | 15 #include <assert.h> |
| 16 | 16 |
| 17 /* Interface header for common constant data structures and lookup tables */ | 17 /* Interface header for common constant data structures and lookup tables */ |
| 18 | 18 |
| 19 #include "vpx_mem/vpx_mem.h" | 19 #include "vpx_mem/vpx_mem.h" |
| 20 | 20 |
| 21 #ifdef __cplusplus | 21 #ifdef __cplusplus |
| 22 extern "C" { | 22 extern "C" { |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #define MIN(x, y) (((x) < (y)) ? (x) : (y)) | |
| 26 #define MAX(x, y) (((x) > (y)) ? (x) : (y)) | |
| 27 | |
| 28 /* Only need this for fixed-size arrays, for structs just assign. */ | 25 /* Only need this for fixed-size arrays, for structs just assign. */ |
| 29 | 26 |
| 30 #define vp8_copy( Dest, Src) { \ | 27 #define vp8_copy( Dest, Src) { \ |
| 31 assert( sizeof( Dest) == sizeof( Src)); \ | 28 assert( sizeof( Dest) == sizeof( Src)); \ |
| 32 memcpy( Dest, Src, sizeof( Src)); \ | 29 memcpy( Dest, Src, sizeof( Src)); \ |
| 33 } | 30 } |
| 34 | 31 |
| 35 /* Use this for variably-sized arrays. */ | 32 /* Use this for variably-sized arrays. */ |
| 36 | 33 |
| 37 #define vp8_copy_array( Dest, Src, N) { \ | 34 #define vp8_copy_array( Dest, Src, N) { \ |
| 38 assert( sizeof( *Dest) == sizeof( *Src)); \ | 35 assert( sizeof( *Dest) == sizeof( *Src)); \ |
| 39 memcpy( Dest, Src, N * sizeof( *Src)); \ | 36 memcpy( Dest, Src, N * sizeof( *Src)); \ |
| 40 } | 37 } |
| 41 | 38 |
| 42 #define vp8_zero( Dest) memset( &Dest, 0, sizeof( Dest)); | 39 #define vp8_zero( Dest) memset( &Dest, 0, sizeof( Dest)); |
| 43 | 40 |
| 44 #define vp8_zero_array( Dest, N) memset( Dest, 0, N * sizeof( *Dest)); | 41 #define vp8_zero_array( Dest, N) memset( Dest, 0, N * sizeof( *Dest)); |
| 45 | 42 |
| 46 | 43 |
| 47 #ifdef __cplusplus | 44 #ifdef __cplusplus |
| 48 } // extern "C" | 45 } // extern "C" |
| 49 #endif | 46 #endif |
| 50 | 47 |
| 51 #endif // VP8_COMMON_COMMON_H_ | 48 #endif // VP8_COMMON_COMMON_H_ |
| OLD | NEW |