Merge "zip_writer.cc: update powerof2 and use it unconditionally" am: b86e248e8b am: 0fd9adf747

am: 707d0b6da5

Change-Id: Iac67cf33d1bd51920cd06741f9e39ab3ccabf3b8
This commit is contained in:
Nick Kralevich 2019-03-28 14:04:15 -07:00 committed by android-build-merger
commit 8f1e95e03e
1 changed files with 7 additions and 3 deletions

View File

@ -30,9 +30,13 @@
#include "entry_name_utils-inl.h"
#include "zip_archive_common.h"
#if !defined(powerof2)
#define powerof2(x) ((((x)-1) & (x)) == 0)
#endif
#undef powerof2
#define powerof2(x) \
({ \
__typeof__(x) _x = (x); \
__typeof__(x) _x2; \
__builtin_add_overflow(_x, -1, &_x2) ? 1 : ((_x2 & _x) == 0); \
})
/* Zip compression methods we support */
enum {