Commit cb37db12 authored by Debargha Mukherjee's avatar Debargha Mukherjee Committed by Gerrit Code Review

Merge "Fix copy/zero macros." into nextgenv2

parents b00aa8f2 a301f5e0
...@@ -33,12 +33,12 @@ extern "C" { ...@@ -33,12 +33,12 @@ extern "C" {
// Use this for variably-sized arrays. // Use this for variably-sized arrays.
#define vp10_copy_array(dest, src, n) { \ #define vp10_copy_array(dest, src, n) { \
assert(sizeof(*dest) == sizeof(*src)); \ assert(sizeof(*(dest)) == sizeof(*(src))); \
memcpy(dest, src, n * sizeof(*src)); \ memcpy(dest, src, n * sizeof(*(src))); \
} }
#define vp10_zero(dest) memset(&(dest), 0, sizeof(dest)) #define vp10_zero(dest) memset(&(dest), 0, sizeof(dest))
#define vp10_zero_array(dest, n) memset(dest, 0, n * sizeof(*dest)) #define vp10_zero_array(dest, n) memset(dest, 0, n * sizeof(*(dest)))
static INLINE int get_unsigned_bits(unsigned int num_values) { static INLINE int get_unsigned_bits(unsigned int num_values) {
return num_values > 0 ? get_msb(num_values) + 1 : 0; return num_values > 0 ? get_msb(num_values) + 1 : 0;
......
...@@ -32,13 +32,13 @@ extern "C" { ...@@ -32,13 +32,13 @@ extern "C" {
/* Use this for variably-sized arrays. */ /* Use this for variably-sized arrays. */
#define vp8_copy_array( Dest, Src, N) { \ #define vp8_copy_array( Dest, Src, N) { \
assert( sizeof( *Dest) == sizeof( *Src)); \ assert( sizeof( *(Dest)) == sizeof( *(Src))); \
memcpy( Dest, Src, N * sizeof( *Src)); \ memcpy( Dest, Src, N * sizeof( *(Src))); \
} }
#define vp8_zero( Dest) memset( &Dest, 0, sizeof( Dest)); #define vp8_zero( Dest) memset( &(Dest), 0, sizeof( Dest));
#define vp8_zero_array( Dest, N) memset( Dest, 0, N * sizeof( *Dest)); #define vp8_zero_array( Dest, N) memset( Dest, 0, N * sizeof( *(Dest)));
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -33,12 +33,12 @@ extern "C" { ...@@ -33,12 +33,12 @@ extern "C" {
// Use this for variably-sized arrays. // Use this for variably-sized arrays.
#define vp9_copy_array(dest, src, n) { \ #define vp9_copy_array(dest, src, n) { \
assert(sizeof(*dest) == sizeof(*src)); \ assert(sizeof(*(dest)) == sizeof(*(src))); \
memcpy(dest, src, n * sizeof(*src)); \ memcpy(dest, src, n * sizeof(*(src))); \
} }
#define vp9_zero(dest) memset(&(dest), 0, sizeof(dest)) #define vp9_zero(dest) memset(&(dest), 0, sizeof(dest))
#define vp9_zero_array(dest, n) memset(dest, 0, n * sizeof(*dest)) #define vp9_zero_array(dest, n) memset(dest, 0, n * sizeof(*(dest)))
static INLINE int get_unsigned_bits(unsigned int num_values) { static INLINE int get_unsigned_bits(unsigned int num_values) {
return num_values > 0 ? get_msb(num_values) + 1 : 0; return num_values > 0 ? get_msb(num_values) + 1 : 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment