Commit 2cb7e512 authored by fbarchard@google.com's avatar fbarchard@google.com

Change Mac to long long for int64

BUG=140
TESTED=libyuv_unittest.exe --gtest_filter=*Size*
Review URL: https://webrtc-codereview.appspot.com/932010

git-svn-id: http://libyuv.googlecode.com/svn/trunk@462 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 9f2d4041
......@@ -30,7 +30,7 @@ typedef __int64 int64;
#endif
#define INT64_F "I64"
#else // COMPILER_MSVC
#ifdef __LP64__
#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
typedef unsigned long uint64; // NOLINT
typedef long int64; // NOLINT
#ifndef INT64_C
......@@ -40,7 +40,7 @@ typedef long int64; // NOLINT
#define UINT64_C(x) x ## UL
#endif
#define INT64_F "l"
#else // __LP64__
#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
typedef unsigned long long uint64; // NOLINT
typedef long long int64; // NOLINT
#ifndef INT64_C
......
......@@ -26,6 +26,7 @@
'unit_test/unit_test.h',
# sources
'unit_test/basictypes_test.cc',
'unit_test/compare_test.cc',
'unit_test/convert_test.cc',
'unit_test/cpu_test.cc',
......
/*
* Copyright 2012 The LibYuv Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <stdlib.h>
#include <string.h>
#include "../unit_test/unit_test.h"
#include "libyuv/basic_types.h"
namespace libyuv {
TEST_F(libyuvTest, Endian) {
uint16 v16 = 0x1234u;
uint8 first_byte = *reinterpret_cast<uint8*>(&v16);
#if defined(ARCH_CPU_LITTLE_ENDIAN)
EXPECT_EQ(0x34u, first_byte);
#elif defined(ARCH_CPU_BIG_ENDIAN)
EXPECT_EQ(0x12u, first_byte);
#endif
}
TEST_F(libyuvTest, SizeOfTypes) {
EXPECT_EQ(1u, sizeof(int8)); // NOLINT Using sizeof(type)
EXPECT_EQ(1u, sizeof(uint8)); // NOLINT
EXPECT_EQ(2u, sizeof(int16)); // NOLINT
EXPECT_EQ(2u, sizeof(uint16)); // NOLINT
EXPECT_EQ(4u, sizeof(int32)); // NOLINT
EXPECT_EQ(4u, sizeof(uint32)); // NOLINT
EXPECT_EQ(8u, sizeof(int64)); // NOLINT
EXPECT_EQ(8u, sizeof(uint64)); // NOLINT
}
TEST_F(libyuvTest, 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