common.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef VP8_COMMON_COMMON_H_
  11. #define VP8_COMMON_COMMON_H_
  12. #include <assert.h>
  13. /* Interface header for common constant data structures and lookup tables */
  14. #include "vpx_mem/vpx_mem.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* Only need this for fixed-size arrays, for structs just assign. */
  19. #define vp8_copy( Dest, Src) { \
  20. assert( sizeof( Dest) == sizeof( Src)); \
  21. memcpy( Dest, Src, sizeof( Src)); \
  22. }
  23. /* Use this for variably-sized arrays. */
  24. #define vp8_copy_array( Dest, Src, N) { \
  25. assert( sizeof( *Dest) == sizeof( *Src)); \
  26. memcpy( Dest, Src, N * sizeof( *Src)); \
  27. }
  28. #define vp8_zero( Dest) memset( &Dest, 0, sizeof( Dest));
  29. #define vp8_zero_array( Dest, N) memset( Dest, 0, N * sizeof( *Dest));
  30. #ifdef __cplusplus
  31. } // extern "C"
  32. #endif
  33. #endif // VP8_COMMON_COMMON_H_