Unify 64bit int constant definitions.
LL and ULL prefixes are word size dependent, use the INT64_C and UINT64_C
macros instead.
Change-Id: I5b70027651898814fc0b3e9e22a18a1047e76cb9
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index e6aa9c2..d0555ff 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -918,7 +918,7 @@
fh.ChangeField(s5);
EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimLong);
EXPECT_EQ(0x1234567890abcdefLL, s5->GetLong(statics.get()));
- s5->SetLong<false>(statics.get(), 0x34567890abcdef12LL);
+ s5->SetLong<false>(statics.get(), INT64_C(0x34567890abcdef12));
mirror::ArtField* s6 = statics->FindStaticField("s6", "F");
fh.ChangeField(s6);
@@ -946,7 +946,7 @@
EXPECT_EQ('b', s2->GetChar(statics.get()));
EXPECT_EQ(-535, s3->GetShort(statics.get()));
EXPECT_EQ(2000000001, s4->GetInt(statics.get()));
- EXPECT_EQ(0x34567890abcdef12LL, s5->GetLong(statics.get()));
+ EXPECT_EQ(INT64_C(0x34567890abcdef12), s5->GetLong(statics.get()));
EXPECT_EQ(0.75, s6->GetFloat(statics.get()));
EXPECT_EQ(16777219, s7->GetDouble(statics.get()));
EXPECT_TRUE(s8->GetObject(statics.get())->AsString()->Equals("robot"));
diff --git a/runtime/entrypoints/math_entrypoints_test.cc b/runtime/entrypoints/math_entrypoints_test.cc
index b69aeb4..f70a2da 100644
--- a/runtime/entrypoints/math_entrypoints_test.cc
+++ b/runtime/entrypoints/math_entrypoints_test.cc
@@ -27,25 +27,25 @@
TEST_F(MathEntrypointsTest, DoubleToLong) {
EXPECT_EQ(std::numeric_limits<int64_t>::max(), art_d2l(1.85e19));
EXPECT_EQ(std::numeric_limits<int64_t>::min(), art_d2l(-1.85e19));
- EXPECT_EQ(0LL, art_d2l(0));
- EXPECT_EQ(1LL, art_d2l(1.0));
- EXPECT_EQ(10LL, art_d2l(10.0));
- EXPECT_EQ(100LL, art_d2l(100.0));
- EXPECT_EQ(-1LL, art_d2l(-1.0));
- EXPECT_EQ(-10LL, art_d2l(-10.0));
- EXPECT_EQ(-100LL, art_d2l(-100.0));
+ EXPECT_EQ(INT64_C(0), art_d2l(0));
+ EXPECT_EQ(INT64_C(1), art_d2l(1.0));
+ EXPECT_EQ(INT64_C(10), art_d2l(10.0));
+ EXPECT_EQ(INT64_C(100), art_d2l(100.0));
+ EXPECT_EQ(INT64_C(-1), art_d2l(-1.0));
+ EXPECT_EQ(INT64_C(-10), art_d2l(-10.0));
+ EXPECT_EQ(INT64_C(-100), art_d2l(-100.0));
}
TEST_F(MathEntrypointsTest, FloatToLong) {
EXPECT_EQ(std::numeric_limits<int64_t>::max(), art_f2l(1.85e19));
EXPECT_EQ(std::numeric_limits<int64_t>::min(), art_f2l(-1.85e19));
- EXPECT_EQ(0LL, art_f2l(0));
- EXPECT_EQ(1LL, art_f2l(1.0));
- EXPECT_EQ(10LL, art_f2l(10.0));
- EXPECT_EQ(100LL, art_f2l(100.0));
- EXPECT_EQ(-1LL, art_f2l(-1.0));
- EXPECT_EQ(-10LL, art_f2l(-10.0));
- EXPECT_EQ(-100LL, art_f2l(-100.0));
+ EXPECT_EQ(INT64_C(0), art_f2l(0));
+ EXPECT_EQ(INT64_C(1), art_f2l(1.0));
+ EXPECT_EQ(INT64_C(10), art_f2l(10.0));
+ EXPECT_EQ(INT64_C(100), art_f2l(100.0));
+ EXPECT_EQ(INT64_C(-1), art_f2l(-1.0));
+ EXPECT_EQ(INT64_C(-10), art_f2l(-10.0));
+ EXPECT_EQ(INT64_C(-100), art_f2l(-100.0));
}
TEST_F(MathEntrypointsTest, DoubleToInt) {
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 40aebfa..694f5e4 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -30,7 +30,7 @@
static bool GetFieldValue(const ScopedFastNativeObjectAccess& soa, mirror::Object* o,
mirror::ArtField* f, JValue& value, bool allow_references)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK_EQ(value.GetJ(), 0LL);
+ DCHECK_EQ(value.GetJ(), INT64_C(0));
CHECK(!kMovingFields);
SirtRef<mirror::Object> sirt_obj(soa.Self(), o);
SirtRef<mirror::Class> sirt_klass(soa.Self(), f->GetDeclaringClass());
diff --git a/runtime/profiler.cc b/runtime/profiler.cc
index da98938..4770a54 100644
--- a/runtime/profiler.cc
+++ b/runtime/profiler.cc
@@ -163,7 +163,7 @@
uint64_t start_us = MicroTime();
- uint64_t end_us = start_us + profiler->duration_s_ * 1000000LL;
+ uint64_t end_us = start_us + profiler->duration_s_ * UINT64_C(1000000);
uint64_t now_us = start_us;
LOG(DEBUG) << "Starting profiling run now for " << PrettyDuration((end_us - start_us) * 1000);
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 680d269..fbdf95f 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -518,7 +518,7 @@
pthread_getcpuclockid(pthread_self_, &cpu_clock_id);
timespec now;
clock_gettime(cpu_clock_id, &now);
- return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000) + now.tv_nsec / UINT64_C(1000);
#else
UNIMPLEMENTED(WARNING);
return -1;
diff --git a/runtime/utils.cc b/runtime/utils.cc
index 2b57778..afbcbb7 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -136,11 +136,11 @@
#if defined(HAVE_POSIX_CLOCKS)
timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
- return static_cast<uint64_t>(now.tv_sec) * 1000LL + now.tv_nsec / 1000000LL;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000) + now.tv_nsec / UINT64_C(1000000);
#else
timeval now;
gettimeofday(&now, NULL);
- return static_cast<uint64_t>(now.tv_sec) * 1000LL + now.tv_usec / 1000LL;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000) + now.tv_usec / UINT64_C(1000);
#endif
}
@@ -148,11 +148,11 @@
#if defined(HAVE_POSIX_CLOCKS)
timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
- return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_nsec / 1000LL;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000) + now.tv_nsec / UINT64_C(1000);
#else
timeval now;
gettimeofday(&now, NULL);
- return static_cast<uint64_t>(now.tv_sec) * 1000000LL + now.tv_usec;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000) + now.tv_usec;
#endif
}
@@ -160,11 +160,11 @@
#if defined(HAVE_POSIX_CLOCKS)
timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
- return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_nsec;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + now.tv_nsec;
#else
timeval now;
gettimeofday(&now, NULL);
- return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_usec * 1000LL;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + now.tv_usec * UINT64_C(1000);
#endif
}
@@ -172,7 +172,7 @@
#if defined(HAVE_POSIX_CLOCKS)
timespec now;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now);
- return static_cast<uint64_t>(now.tv_sec) * 1000000000LL + now.tv_nsec;
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + now.tv_nsec;
#else
UNIMPLEMENTED(WARNING);
return -1;