Commit 13771ffa authored by Frank Barchard's avatar Frank Barchard Committed by Frank Barchard

basic_types.h - remove unused macros

Removes macros that were part of standard basic_types
header but not used by libyuv itself.

TBR=braveyao@chromium.org
Bug: libyuv:774
Test: try bots still build
Change-Id: I8de6fad5a9277df0a50959881392ba212b1b5972
Reviewed-on: https://chromium-review.googlesource.com/879591Reviewed-by: 's avatarFrank Barchard <fbarchard@chromium.org>
parent a11ffa16
......@@ -25,34 +25,13 @@
#ifdef COMPILER_MSVC
typedef unsigned __int64 uint64;
typedef __int64 int64;
#ifndef INT64_C
#define INT64_C(x) x##I64
#endif
#ifndef UINT64_C
#define UINT64_C(x) x##UI64
#endif
#define INT64_F "I64"
#else // COMPILER_MSVC
#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
typedef unsigned long uint64; // NOLINT
typedef long int64; // NOLINT
#ifndef INT64_C
#define INT64_C(x) x##L
#endif
#ifndef UINT64_C
#define UINT64_C(x) x##UL
#endif
#define INT64_F "l"
#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
typedef unsigned long long uint64; // NOLINT
typedef long long int64; // NOLINT
#ifndef INT64_C
#define INT64_C(x) x##LL
#endif
#ifndef UINT64_C
#define UINT64_C(x) x##ULL
#endif
#define INT64_F "ll"
#endif // __LP64__
#endif // COMPILER_MSVC
typedef unsigned int uint32;
......@@ -64,27 +43,6 @@ typedef signed char int8;
#endif // INT_TYPES_DEFINED
#endif // GG_LONGLONG
// Detect compiler is for x86 or x64.
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
defined(_M_IX86)
#define CPU_X86 1
#endif
// Detect compiler is for ARM.
#if defined(__arm__) || defined(_M_ARM)
#define CPU_ARM 1
#endif
#ifndef ALIGNP
#ifdef __cplusplus
#define ALIGNP(p, t) \
reinterpret_cast<uint8*>( \
((reinterpret_cast<uintptr_t>(p) + ((t)-1)) & ~((t)-1)))
#else
#define ALIGNP(p, t) \
(uint8*)((((uintptr_t)(p) + ((t)-1)) & ~((t)-1))) /* NOLINT */
#endif
#endif
#if !defined(LIBYUV_API)
#if defined(_WIN32) || defined(__CYGWIN__)
#if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
......@@ -107,11 +65,4 @@ typedef signed char int8;
#define LIBYUV_FALSE 0
#define LIBYUV_TRUE 1
// Visual C x86 or GCC little endian.
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define LIBYUV_LITTLE_ENDIAN
#endif
#endif // INCLUDE_LIBYUV_BASIC_TYPES_H_
......@@ -27,8 +27,6 @@
#include <stdio.h>
#include <string.h>
#include "libyuv/basic_types.h" // For CPU_X86
#ifdef __cplusplus
namespace libyuv {
extern "C" {
......@@ -218,7 +216,9 @@ static LIBYUV_BOOL TestEnv(const char*) {
static SAFEBUFFERS int GetCpuFlags(void) {
int cpu_info = 0;
#if !defined(__pnacl__) && !defined(__CLR_VER) && defined(CPU_X86)
#if !defined(__pnacl__) && !defined(__CLR_VER) && \
(defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
defined(_M_IX86))
int cpu_info0[4] = {0, 0, 0, 0};
int cpu_info1[4] = {0, 0, 0, 0};
int cpu_info7[4] = {0, 0, 0, 0};
......
......@@ -67,7 +67,10 @@ static __inline uint32 Clamp10(int32 val) {
return (uint32)(clamp1023(v));
}
#ifdef LIBYUV_LITTLE_ENDIAN
// Little Endian
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define WRITEWORD(p, v) *(uint32*)(p) = v
#else
static inline void WRITEWORD(uint8* p, uint32 v) {
......
......@@ -13,16 +13,6 @@
namespace libyuv {
TEST_F(LibYUVBaseTest, Endian) {
uint16 v16 = 0x1234u;
uint8 first_byte = *reinterpret_cast<uint8*>(&v16);
#if defined(LIBYUV_LITTLE_ENDIAN)
EXPECT_EQ(0x34u, first_byte);
#else
EXPECT_EQ(0x12u, first_byte);
#endif
}
TEST_F(LibYUVBaseTest, SizeOfTypes) {
int8 i8 = -1;
uint8 u8 = 1u;
......@@ -50,11 +40,4 @@ TEST_F(LibYUVBaseTest, SizeOfTypes) {
EXPECT_LT(0u, u64);
}
TEST_F(LibYUVBaseTest, SizeOfConstants) {
EXPECT_EQ(8u, sizeof(INT64_C(0)));
EXPECT_EQ(8u, sizeof(UINT64_C(0)));
EXPECT_EQ(8u, sizeof(INT64_C(0x1234567887654321)));
EXPECT_EQ(8u, sizeof(UINT64_C(0x8765432112345678)));
}
} // namespace libyuv
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