1/*
2 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
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
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11
12#ifndef VP8_COMMON_COMMON_H_
13#define VP8_COMMON_COMMON_H_
14
15#include <assert.h>
16
17/* Interface header for common constant data structures and lookup tables */
18
19#include "vpx_mem/vpx_mem.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
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. */
29
30#define vp8_copy( Dest, Src) { \
31        assert( sizeof( Dest) == sizeof( Src)); \
32        memcpy( Dest, Src, sizeof( Src)); \
33    }
34
35/* Use this for variably-sized arrays. */
36
37#define vp8_copy_array( Dest, Src, N) { \
38        assert( sizeof( *Dest) == sizeof( *Src)); \
39        memcpy( Dest, Src, N * sizeof( *Src)); \
40    }
41
42#define vp8_zero( Dest)  memset( &Dest, 0, sizeof( Dest));
43
44#define vp8_zero_array( Dest, N)  memset( Dest, 0, N * sizeof( *Dest));
45
46
47#ifdef __cplusplus
48}  // extern "C"
49#endif
50
51#endif  // VP8_COMMON_COMMON_H_
52