Merge "Add support for rsDebug with 64-bit types."
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index e0de867..9fadee0 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -307,6 +307,9 @@
 static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
     LOGE("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
 }
+static void SC_debugD(const char *s, double d) {
+    LOGE("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
+}
 static void SC_debugFM4v4(const char *s, const float *f) {
     LOGE("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
     LOGE("%s  %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
@@ -327,7 +330,13 @@
     LOGE("%s %i  0x%x", s, i, i);
 }
 static void SC_debugU32(const char *s, uint32_t i) {
-    LOGE("%s %i  0x%x", s, i, i);
+    LOGE("%s %u  0x%x", s, i, i);
+}
+static void SC_debugLL64(const char *s, long long ll) {
+    LOGE("%s %lld  0x%llx", s, ll, ll);
+}
+static void SC_debugULL64(const char *s, unsigned long long ll) {
+    LOGE("%s %llu  0x%llx", s, ll, ll);
 }
 
 static void SC_debugP(const char *s, const void *p) {
@@ -494,11 +503,19 @@
     { "_Z7rsDebugPKcff", (void *)&SC_debugFv2 },
     { "_Z7rsDebugPKcfff", (void *)&SC_debugFv3 },
     { "_Z7rsDebugPKcffff", (void *)&SC_debugFv4 },
+    { "_Z7rsDebugPKcd", (void *)&SC_debugD },
     { "_Z7rsDebugPKcPK12rs_matrix4x4", (void *)&SC_debugFM4v4 },
     { "_Z7rsDebugPKcPK12rs_matrix3x3", (void *)&SC_debugFM3v3 },
     { "_Z7rsDebugPKcPK12rs_matrix2x2", (void *)&SC_debugFM2v2 },
     { "_Z7rsDebugPKci", (void *)&SC_debugI32 },
     { "_Z7rsDebugPKcj", (void *)&SC_debugU32 },
+    // Both "long" and "unsigned long" need to be redirected to their
+    // 64-bit counterparts, since we have hacked Slang to use 64-bit
+    // for "long" on Arm (to be similar to Java).
+    { "_Z7rsDebugPKcl", (void *)&SC_debugLL64 },
+    { "_Z7rsDebugPKcm", (void *)&SC_debugULL64 },
+    { "_Z7rsDebugPKcx", (void *)&SC_debugLL64 },
+    { "_Z7rsDebugPKcy", (void *)&SC_debugULL64 },
     { "_Z7rsDebugPKcPKv", (void *)&SC_debugP },
 
     // RS Math
diff --git a/libs/rs/scriptc/rs_core.rsh b/libs/rs/scriptc/rs_core.rsh
index 9950184..0e0532c 100644
--- a/libs/rs/scriptc/rs_core.rsh
+++ b/libs/rs/scriptc/rs_core.rsh
@@ -11,6 +11,8 @@
 extern void __attribute__((overloadable))
     rsDebug(const char *, float, float, float, float);
 extern void __attribute__((overloadable))
+    rsDebug(const char *, double);
+extern void __attribute__((overloadable))
     rsDebug(const char *, const rs_matrix4x4 *);
 extern void __attribute__((overloadable))
     rsDebug(const char *, const rs_matrix3x3 *);
@@ -21,6 +23,14 @@
 extern void __attribute__((overloadable))
     rsDebug(const char *, uint);
 extern void __attribute__((overloadable))
+    rsDebug(const char *, long);
+extern void __attribute__((overloadable))
+    rsDebug(const char *, unsigned long);
+extern void __attribute__((overloadable))
+    rsDebug(const char *, long long);
+extern void __attribute__((overloadable))
+    rsDebug(const char *, unsigned long long);
+extern void __attribute__((overloadable))
     rsDebug(const char *, const void *);
 #define RS_DEBUG(a) rsDebug(#a, a)
 #define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
@@ -803,7 +813,7 @@
 /////////////////////////////////////////////////////
 // utility funcs
 /////////////////////////////////////////////////////
-void __attribute__((overloadable))
+__inline__ static void __attribute__((overloadable, always_inline))
 rsExtractFrustumPlanes(const rs_matrix4x4 *modelViewProj,
                          float4 *left, float4 *right,
                          float4 *top, float4 *bottom,
@@ -853,7 +863,7 @@
     *far /= len;
 }
 
-bool __attribute__((overloadable))
+__inline__ static bool __attribute__((overloadable, always_inline))
 rsIsSphereInFrustum(float4 *sphere,
                       float4 *left, float4 *right,
                       float4 *top, float4 *bottom,