mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
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/879591 Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
a11ffa1625
commit
13771ffaad
@ -25,34 +25,13 @@
|
|||||||
#ifdef COMPILER_MSVC
|
#ifdef COMPILER_MSVC
|
||||||
typedef unsigned __int64 uint64;
|
typedef unsigned __int64 uint64;
|
||||||
typedef __int64 int64;
|
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
|
#else // COMPILER_MSVC
|
||||||
#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
||||||
typedef unsigned long uint64; // NOLINT
|
typedef unsigned long uint64; // NOLINT
|
||||||
typedef long int64; // 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__)
|
#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
||||||
typedef unsigned long long uint64; // NOLINT
|
typedef unsigned long long uint64; // NOLINT
|
||||||
typedef long long int64; // 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 // __LP64__
|
||||||
#endif // COMPILER_MSVC
|
#endif // COMPILER_MSVC
|
||||||
typedef unsigned int uint32;
|
typedef unsigned int uint32;
|
||||||
@ -64,27 +43,6 @@ typedef signed char int8;
|
|||||||
#endif // INT_TYPES_DEFINED
|
#endif // INT_TYPES_DEFINED
|
||||||
#endif // GG_LONGLONG
|
#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(LIBYUV_API)
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
#if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
|
#if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
|
||||||
@ -107,11 +65,4 @@ typedef signed char int8;
|
|||||||
#define LIBYUV_FALSE 0
|
#define LIBYUV_FALSE 0
|
||||||
#define LIBYUV_TRUE 1
|
#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_
|
#endif // INCLUDE_LIBYUV_BASIC_TYPES_H_
|
||||||
|
|||||||
@ -27,8 +27,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "libyuv/basic_types.h" // For CPU_X86
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
namespace libyuv {
|
namespace libyuv {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -218,7 +216,9 @@ static LIBYUV_BOOL TestEnv(const char*) {
|
|||||||
|
|
||||||
static SAFEBUFFERS int GetCpuFlags(void) {
|
static SAFEBUFFERS int GetCpuFlags(void) {
|
||||||
int cpu_info = 0;
|
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_info0[4] = {0, 0, 0, 0};
|
||||||
int cpu_info1[4] = {0, 0, 0, 0};
|
int cpu_info1[4] = {0, 0, 0, 0};
|
||||||
int cpu_info7[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));
|
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
|
#define WRITEWORD(p, v) *(uint32*)(p) = v
|
||||||
#else
|
#else
|
||||||
static inline void WRITEWORD(uint8* p, uint32 v) {
|
static inline void WRITEWORD(uint8* p, uint32 v) {
|
||||||
|
|||||||
@ -13,16 +13,6 @@
|
|||||||
|
|
||||||
namespace libyuv {
|
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) {
|
TEST_F(LibYUVBaseTest, SizeOfTypes) {
|
||||||
int8 i8 = -1;
|
int8 i8 = -1;
|
||||||
uint8 u8 = 1u;
|
uint8 u8 = 1u;
|
||||||
@ -50,11 +40,4 @@ TEST_F(LibYUVBaseTest, SizeOfTypes) {
|
|||||||
EXPECT_LT(0u, u64);
|
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
|
} // namespace libyuv
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user