Update RS prebuilts for lmp-dev.

Bug: 14416410
Change-Id: I7aecc8982a600d22c68e2f72b74d05275b6b5d1d
diff --git a/renderscript/include/rs_allocation.rsh b/renderscript/include/rs_allocation.rsh
index 773c386..6f3f8d9 100644
--- a/renderscript/include/rs_allocation.rsh
+++ b/renderscript/include/rs_allocation.rsh
@@ -375,7 +375,7 @@
 #endif // (defined(RS_VERSION) && (RS_VERSION >= 18))
 
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+#if (defined(RS_VERSION) && (RS_VERSION >= 999))
 
 #define VOP(T)                                                                   \
     extern T __attribute__((overloadable))                                       \
diff --git a/renderscript/include/rs_atomic.rsh b/renderscript/include/rs_atomic.rsh
index fef05bb..ba847cf 100644
--- a/renderscript/include/rs_atomic.rsh
+++ b/renderscript/include/rs_atomic.rsh
@@ -177,7 +177,7 @@
 
 #endif //defined(RS_VERSION) && (RS_VERSION >= 14)
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))   // TODO: api 21
 
 /**
  * Atomic add one to the value at addr.
diff --git a/renderscript/include/rs_core_math.rsh b/renderscript/include/rs_core_math.rsh
index c7cc331..287a1b9 100644
--- a/renderscript/include/rs_core_math.rsh
+++ b/renderscript/include/rs_core_math.rsh
@@ -456,7 +456,7 @@
  *
  * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))atanh(float);
+extern float __attribute__((const, overloadable))atanh(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
@@ -465,7 +465,7 @@
  *
  * Supported by API versions 9 and newer.
  */
-extern float2 __attribute__((const, overloadable))atanh(float2);
+extern float2 __attribute__((const, overloadable))atanh(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
@@ -474,7 +474,7 @@
  *
  * Supported by API versions 9 and newer.
  */
-extern float3 __attribute__((const, overloadable))atanh(float3);
+extern float3 __attribute__((const, overloadable))atanh(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
@@ -483,7 +483,7 @@
  *
  * Supported by API versions 9 and newer.
  */
-extern float4 __attribute__((const, overloadable))atanh(float4);
+extern float4 __attribute__((const, overloadable))atanh(float4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
@@ -5667,7 +5667,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the log gamma and sign
+ * Return the log gamma
  *
  * Supported by API versions 9 and newer.
  */
@@ -5676,7 +5676,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the log gamma and sign
+ * Return the log gamma
  *
  * Supported by API versions 9 and newer.
  */
@@ -5685,7 +5685,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the log gamma and sign
+ * Return the log gamma
  *
  * Supported by API versions 9 and newer.
  */
@@ -5694,7 +5694,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the log gamma and sign
+ * Return the log gamma
  *
  * Supported by API versions 9 and newer.
  */
@@ -6325,290 +6325,290 @@
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char __attribute__((const, overloadable))max(char v1, char v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char2 __attribute__((const, overloadable))max(char2 v1, char2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char3 __attribute__((const, overloadable))max(char3 v1, char3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char4 __attribute__((const, overloadable))max(char4 v1, char4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar __attribute__((const, overloadable))max(uchar v1, uchar v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar2 __attribute__((const, overloadable))max(uchar2 v1, uchar2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar3 __attribute__((const, overloadable))max(uchar3 v1, uchar3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar4 __attribute__((const, overloadable))max(uchar4 v1, uchar4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short __attribute__((const, overloadable))max(short v1, short v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short2 __attribute__((const, overloadable))max(short2 v1, short2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short3 __attribute__((const, overloadable))max(short3 v1, short3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short4 __attribute__((const, overloadable))max(short4 v1, short4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort __attribute__((const, overloadable))max(ushort v1, ushort v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort2 __attribute__((const, overloadable))max(ushort2 v1, ushort2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort3 __attribute__((const, overloadable))max(ushort3 v1, ushort3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort4 __attribute__((const, overloadable))max(ushort4 v1, ushort4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int __attribute__((const, overloadable))max(int v1, int v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int2 __attribute__((const, overloadable))max(int2 v1, int2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int3 __attribute__((const, overloadable))max(int3 v1, int3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int4 __attribute__((const, overloadable))max(int4 v1, int4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint __attribute__((const, overloadable))max(uint v1, uint v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint2 __attribute__((const, overloadable))max(uint2 v1, uint2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint3 __attribute__((const, overloadable))max(uint3 v1, uint3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint4 __attribute__((const, overloadable))max(uint4 v1, uint4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long __attribute__((const, overloadable))max(long v1, long v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long2 __attribute__((const, overloadable))max(long2 v1, long2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long3 __attribute__((const, overloadable))max(long3 v1, long3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long4 __attribute__((const, overloadable))max(long4 v1, long4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong __attribute__((const, overloadable))max(ulong v1, ulong v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong2 __attribute__((const, overloadable))max(ulong2 v1, ulong2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong3 __attribute__((const, overloadable))max(ulong3 v1, ulong3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the maximum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong4 __attribute__((const, overloadable))max(ulong4 v1, ulong4 v2);
 #endif
@@ -6985,290 +6985,290 @@
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char __attribute__((const, overloadable))min(char v1, char v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char2 __attribute__((const, overloadable))min(char2 v1, char2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char3 __attribute__((const, overloadable))min(char3 v1, char3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern char4 __attribute__((const, overloadable))min(char4 v1, char4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar __attribute__((const, overloadable))min(uchar v1, uchar v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar2 __attribute__((const, overloadable))min(uchar2 v1, uchar2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar3 __attribute__((const, overloadable))min(uchar3 v1, uchar3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uchar4 __attribute__((const, overloadable))min(uchar4 v1, uchar4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short __attribute__((const, overloadable))min(short v1, short v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short2 __attribute__((const, overloadable))min(short2 v1, short2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short3 __attribute__((const, overloadable))min(short3 v1, short3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern short4 __attribute__((const, overloadable))min(short4 v1, short4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort __attribute__((const, overloadable))min(ushort v1, ushort v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort2 __attribute__((const, overloadable))min(ushort2 v1, ushort2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort3 __attribute__((const, overloadable))min(ushort3 v1, ushort3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ushort4 __attribute__((const, overloadable))min(ushort4 v1, ushort4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int __attribute__((const, overloadable))min(int v1, int v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int2 __attribute__((const, overloadable))min(int2 v1, int2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int3 __attribute__((const, overloadable))min(int3 v1, int3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern int4 __attribute__((const, overloadable))min(int4 v1, int4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint __attribute__((const, overloadable))min(uint v1, uint v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint2 __attribute__((const, overloadable))min(uint2 v1, uint2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint3 __attribute__((const, overloadable))min(uint3 v1, uint3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern uint4 __attribute__((const, overloadable))min(uint4 v1, uint4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long __attribute__((const, overloadable))min(long v1, long v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long2 __attribute__((const, overloadable))min(long2 v1, long2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long3 __attribute__((const, overloadable))min(long3 v1, long3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern long4 __attribute__((const, overloadable))min(long4 v1, long4 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong __attribute__((const, overloadable))min(ulong v1, ulong v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong2 __attribute__((const, overloadable))min(ulong2 v1, ulong2 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong3 __attribute__((const, overloadable))min(ulong3 v1, ulong3 v2);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * Return the minimum value from two arguments
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern ulong4 __attribute__((const, overloadable))min(ulong4 v1, ulong4 v2);
 #endif
@@ -7727,7 +7727,7 @@
  *
  * Supported by API versions 21 and newer.
  */
-extern float __attribute__((const, overloadable))native_atanh(float);
+extern float __attribute__((const, overloadable))native_atanh(float in);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
@@ -7736,7 +7736,7 @@
  *
  * Supported by API versions 21 and newer.
  */
-extern float2 __attribute__((const, overloadable))native_atanh(float2);
+extern float2 __attribute__((const, overloadable))native_atanh(float2 in);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
@@ -7745,7 +7745,7 @@
  *
  * Supported by API versions 21 and newer.
  */
-extern float3 __attribute__((const, overloadable))native_atanh(float3);
+extern float3 __attribute__((const, overloadable))native_atanh(float3 in);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
@@ -7754,7 +7754,7 @@
  *
  * Supported by API versions 21 and newer.
  */
-extern float4 __attribute__((const, overloadable))native_atanh(float4);
+extern float4 __attribute__((const, overloadable))native_atanh(float4 in);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
@@ -8252,6 +8252,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8261,6 +8262,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8270,6 +8272,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8279,6 +8282,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8288,6 +8292,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log10
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8297,6 +8302,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log10
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8306,6 +8312,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log10
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8315,6 +8322,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log10
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8360,6 +8368,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log2
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8369,6 +8378,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log2
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8378,6 +8388,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log2
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8387,6 +8398,7 @@
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 /*
  * Fast approximate log2
+ * It is not accurate for values very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8434,6 +8446,7 @@
  * Fast approximate v ^ y
  * v must be between 0.f and 256.f
  * y must be between -15.f and 15.f
+ * It is not accurate for values of v very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8445,6 +8458,7 @@
  * Fast approximate v ^ y
  * v must be between 0.f and 256.f
  * y must be between -15.f and 15.f
+ * It is not accurate for values of v very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8456,6 +8470,7 @@
  * Fast approximate v ^ y
  * v must be between 0.f and 256.f
  * y must be between -15.f and 15.f
+ * It is not accurate for values of v very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -8467,6 +8482,7 @@
  * Fast approximate v ^ y
  * v must be between 0.f and 256.f
  * y must be between -15.f and 15.f
+ * It is not accurate for values of v very close to zero.
  *
  * Supported by API versions 18 and newer.
  */
@@ -9143,7 +9159,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the quotient and the remainder of b/c
+ * Return the quotient and the remainder of b/c.  Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
  *
  * Supported by API versions 9 and newer.
  */
@@ -9152,7 +9168,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the quotient and the remainder of b/c
+ * Return the quotient and the remainder of b/c.  Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
  *
  * Supported by API versions 9 and newer.
  */
@@ -9161,7 +9177,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the quotient and the remainder of b/c
+ * Return the quotient and the remainder of b/c.  Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
  *
  * Supported by API versions 9 and newer.
  */
@@ -9170,7 +9186,7 @@
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 9))
 /*
- * Return the quotient and the remainder of b/c
+ * Return the quotient and the remainder of b/c.  Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
  *
  * Supported by API versions 9 and newer.
  */
@@ -9653,38 +9669,38 @@
 extern float4 __attribute__((const, overloadable))step(float4 edge, float v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * if (v < edge)
  * return 0.f;
  * else
  * return 1.f;
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern float2 __attribute__((const, overloadable))step(float edge, float2 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * if (v < edge)
  * return 0.f;
  * else
  * return 1.f;
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern float3 __attribute__((const, overloadable))step(float edge, float3 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
 /*
  * if (v < edge)
  * return 0.f;
  * else
  * return 1.f;
  *
- * Supported by API versions 20 and newer.
+ * Supported by API versions 21 and newer.
  */
 extern float4 __attribute__((const, overloadable))step(float edge, float4 v);
 #endif
diff --git a/renderscript/include/rs_matrix.rsh b/renderscript/include/rs_matrix.rsh
index ebff7f4..34b9532 100644
--- a/renderscript/include/rs_matrix.rsh
+++ b/renderscript/include/rs_matrix.rsh
@@ -15,8 +15,35 @@
  */
 
 /** @file rs_matrix.rsh
- *  \brief Matrix routines
+ *  \brief Matrix functions.
  *
+ * These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4.
+ * They are particularly useful for graphical transformations and are
+ * compatible with OpenGL.
+ *
+ * A few general notes:
+ *
+ * \li We use a zero-based index for rows and columns.  E.g. the last element of
+ * a \ref rs_matrix4x4 is found at (3, 3).
+ *
+ * \li RenderScript uses column-based vectors.  Transforming a vector is done by
+ * postmultiplying the vector, e.g. <em>(matrix * vector)</em>, as provided by
+ * \ref rsMatrixMultiply.
+ *
+ * \li To create a transformation matrix that performs two transformations at
+ * once, multiply the two source matrices, with the first transformation as the
+ * right argument.  E.g. to create a transformation matrix that applies the
+ * transformation \e s1 followed by \e s2, call
+ * </c>rsMatrixLoadMultiply(&combined, &s2, &s1)</c>.
+ * This derives from <em>s2 * (s1 * v)</em>, which is <em>(s2 * s1) * v</em>.
+ *
+ * \li We have two style of functions to create transformation matrices:
+ * rsMatrixLoad<em>Transformation</em> and rsMatrix<em>Transformation</em>.  The
+ * former style simply stores the transformation matrix in the first argument.
+ * The latter modifies a pre-existing transformation matrix so that the new
+ * transformation happens first.  E.g. if you call \ref rsMatrixTranslate
+ * on a matrix that already does a scaling, the resulting matrix when applied
+ * to a vector will first do the translation then the scaling.
  *
  */
 
@@ -24,54 +51,60 @@
 #define __RS_MATRIX_RSH__
 
 /**
- * Set one element of a matrix.
+ * Set an element of a matrix.
  *
- * @param m The matrix to be set
- * @param row
- * @param col
- * @param v
+ * @param m The matrix that will be modified.
+ * @param col The zero-based column of the element to be set.
+ * @param row The zero-based row of the element to be set.
+ * @param v The value to set.
+ *
+ * \warning The order of the column and row parameters may be
+ * unexpected.
  *
  * @return void
  */
 _RS_RUNTIME void __attribute__((overloadable))
-rsMatrixSet(rs_matrix4x4 *m, uint32_t row, uint32_t col, float v);
+rsMatrixSet(rs_matrix4x4 *m, uint32_t col, uint32_t row, float v);
 /**
  * \overload
  */
 _RS_RUNTIME void __attribute__((overloadable))
-rsMatrixSet(rs_matrix3x3 *m, uint32_t row, uint32_t col, float v);
+rsMatrixSet(rs_matrix3x3 *m, uint32_t col, uint32_t row, float v);
 /**
  * \overload
  */
 _RS_RUNTIME void __attribute__((overloadable))
-rsMatrixSet(rs_matrix2x2 *m, uint32_t row, uint32_t col, float v);
+rsMatrixSet(rs_matrix2x2 *m, uint32_t col, uint32_t row, float v);
 
 /**
- * Get one element of a matrix.
+ * Returns one element of a matrix.
  *
- * @param m The matrix to read from
- * @param row
- * @param col
+ * @param m The matrix to extract the element from.
+ * @param col The zero-based column of the element to be extracted.
+ * @param row The zero-based row of the element to extracted.
+ *
+ * \warning The order of the column and row parameters may be
+ * unexpected.
  *
  * @return float
  */
 _RS_RUNTIME float __attribute__((overloadable))
-rsMatrixGet(const rs_matrix4x4 *m, uint32_t row, uint32_t col);
+rsMatrixGet(const rs_matrix4x4 *m, uint32_t col, uint32_t row);
 /**
  * \overload
  */
 _RS_RUNTIME float __attribute__((overloadable))
-rsMatrixGet(const rs_matrix3x3 *m, uint32_t row, uint32_t col);
+rsMatrixGet(const rs_matrix3x3 *m, uint32_t col, uint32_t row);
 /**
  * \overload
  */
 _RS_RUNTIME float __attribute__((overloadable))
-rsMatrixGet(const rs_matrix2x2 *m, uint32_t row, uint32_t col);
+rsMatrixGet(const rs_matrix2x2 *m, uint32_t col, uint32_t row);
 
 /**
  * Set the elements of a matrix to the identity matrix.
  *
- * @param m
+ * @param m The matrix to set.
  */
 extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix4x4 *m);
 /**
@@ -86,7 +119,13 @@
 /**
  * Set the elements of a matrix from an array of floats.
  *
- * @param m
+ * The array of floats should be in row-major order, i.e. the element a
+ * <em>row 0, column 0</em> should be first, followed by the element at
+ * <em>row 0, column 1</em>, etc.
+ *
+ * @param m The matrix to set.
+ * @param v The array of values to set the matrix to. These arrays should be
+ * 4, 9, or 16 floats long, depending on the matrix size.
  */
 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const float *v);
 /**
@@ -98,18 +137,29 @@
  */
 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const float *v);
 /**
- * \overload
+ * Set the elements of a matrix from another matrix.
+ *
+ * If the source matrix is smaller than the destination, the rest of the
+ * destination is filled with elements of the identity matrix.  E.g.
+ * loading a rs_matrix2x2 into a rs_matrix4x4 will give:
+ *
+ * \htmlonly<table>
+ * <tr><td>m00</td><td>m01</td><td>0.0</td><td>0.0</td></tr>
+ * <tr><td>m10</td><td>m11</td><td>0.0</td><td>0.0</td></tr>
+ * <tr><td>0.0</td><td>0.0</td><td>1.0</td><td>0.0</td></tr>
+ * <tr><td>0.0</td><td>0.0</td><td>0.0</td><td>1.0</td></tr>
+ * </table>\endhtmlonly
+ *
+ * @param m The matrix to set.
+ * @param v The source matrix.
  */
 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix4x4 *v);
 /**
  * \overload
  */
 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix3x3 *v);
-
 /**
- * Set the elements of a matrix from another matrix.
- *
- * @param m
+ * \overload
  */
 extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix2x2 *v);
 /**
@@ -124,11 +174,19 @@
 /**
  * Load a rotation matrix.
  *
- * @param m
- * @param rot
- * @param x
- * @param y
- * @param z
+ * This function creates a rotation matrix.  The axis of rotation is the
+ * <em>(x, y, z)</em> vector.
+ *
+ * To rotate a vector, multiply the vector by the created matrix
+ * using \ref rsMatrixMultiply.
+ *
+ * See http://en.wikipedia.org/wiki/Rotation_matrix .
+ *
+ * @param m The matrix to set.
+ * @param rot How much rotation to do, in degrees.
+ * @param x The x component of the vector that is the axis of rotation.
+ * @param y The y component of the vector that is the axis of rotation.
+ * @param z The z component of the vector that is the axis of rotation.
  */
 extern void __attribute__((overloadable))
 rsMatrixLoadRotate(rs_matrix4x4 *m, float rot, float x, float y, float z);
@@ -136,10 +194,16 @@
 /**
  * Load a scale matrix.
  *
- * @param m
- * @param x
- * @param y
- * @param z
+ * This function creates a scaling matrix, where each component of a
+ * vector is multiplied by a number.  This number can be negative.
+ *
+ * To scale a vector, multiply the vector by the created matrix
+ * using \ref rsMatrixMultiply.
+ *
+ * @param m The matrix to set.
+ * @param x The multiple to scale the x components by.
+ * @param y The multiple to scale the y components by.
+ * @param z The multiple to scale the z components by.
  */
 extern void __attribute__((overloadable))
 rsMatrixLoadScale(rs_matrix4x4 *m, float x, float y, float z);
@@ -147,20 +211,38 @@
 /**
  * Load a translation matrix.
  *
- * @param m
- * @param x
- * @param y
- * @param z
+ * This function creates a translation matrix, where a
+ * number is added to each element of a vector.
+ *
+ * To translate a vector, multiply the vector by the created matrix
+ * using \ref rsMatrixMultiply.
+ *
+ * @param m The matrix to set.
+ * @param x The number to add to each x component.
+ * @param y The number to add to each y component.
+ * @param z The number to add to each z component.
  */
 extern void __attribute__((overloadable))
 rsMatrixLoadTranslate(rs_matrix4x4 *m, float x, float y, float z);
 
 /**
- * Multiply two matrix (lhs, rhs) and place the result in m.
+ * Multiply two matrices.
  *
- * @param m
- * @param lhs
- * @param rhs
+ * Sets \e m to the matrix product of <em>lhs * rhs</em>.
+ *
+ * To combine two 4x4 transformaton matrices, multiply the second transformation matrix
+ * by the first transformation matrix.  E.g. to create a transformation matrix that applies
+ * the transformation \e s1 followed by \e s2, call
+ * </c>rsMatrixLoadMultiply(&combined, &s2, &s1)</c>.
+ *
+ * \warning Prior to version 21, storing the result back into right matrix is not supported and
+ * will result in undefined behavior.  Use rsMatrixMulitply instead.   E.g. instead of doing
+ * rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l).
+ * rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected.
+ *
+ * @param m The matrix to set.
+ * @param lhs The left matrix of the product.
+ * @param rhs The right matrix of the product.
  */
 extern void __attribute__((overloadable))
 rsMatrixLoadMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *lhs, const rs_matrix4x4 *rhs);
@@ -176,10 +258,16 @@
 rsMatrixLoadMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs);
 
 /**
- * Multiply the matrix m by rhs and place the result back into m.
+ * Multiply a matrix into another one.
  *
- * @param m (lhs)
- * @param rhs
+ * Sets \e m to the matrix product <em>m * rhs</em>.
+ *
+ * When combining two 4x4 transformation matrices using this function, the resulting
+ * matrix will correspond to performing the \e rhs transformation first followed by
+ * the original \e m transformation.
+ *
+ * @param m The left matrix of the product and the matrix to be set.
+ * @param rhs The right matrix of the product.
  */
 extern void __attribute__((overloadable))
 rsMatrixMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *rhs);
@@ -195,43 +283,73 @@
 rsMatrixMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *rhs);
 
 /**
- * Multiple matrix m with a rotation matrix
+ * Multiply the matrix \e m with a rotation matrix.
  *
- * @param m
- * @param rot
- * @param x
- * @param y
- * @param z
+ * This function modifies a transformation matrix to first do a rotation.
+ * The axis of rotation is the <em>(x, y, z)</em> vector.
+ *
+ * To apply this combined transformation to a vector, multiply
+ * the vector by the created matrix using \ref rsMatrixMultiply.
+ *
+ * @param m The matrix to modify.
+ * @param rot How much rotation to do, in degrees.
+ * @param x The x component of the vector that is the axis of rotation.
+ * @param y The y component of the vector that is the axis of rotation.
+ * @param z The z component of the vector that is the axis of rotation.
  */
 extern void __attribute__((overloadable))
 rsMatrixRotate(rs_matrix4x4 *m, float rot, float x, float y, float z);
 
 /**
- * Multiple matrix m with a scale matrix
+ * Multiply the matrix \e m with a scaling matrix.
  *
- * @param m
- * @param x
- * @param y
- * @param z
+ * This function modifies a transformation matrix to first do a scaling.
+ * When scaling, each component of a vector is multiplied by a number.
+ * This number can be negative.
+ *
+ * To apply this combined transformation to a vector, multiply
+ * the vector by the created matrix using \ref rsMatrixMultiply.
+ *
+ * @param m The matrix to modify.
+ * @param x The multiple to scale the x components by.
+ * @param y The multiple to scale the y components by.
+ * @param z The multiple to scale the z components by.
  */
 extern void __attribute__((overloadable))
 rsMatrixScale(rs_matrix4x4 *m, float x, float y, float z);
 
 /**
- * Multiple matrix m with a translation matrix
+ * Multiply the matrix \e m with a translation matrix.
  *
- * @param m
- * @param x
- * @param y
- * @param z
+ * This function modifies a transformation matrix to first
+ * do a translation.  When translating, a number is added
+ * to each component of a vector.
+ *
+ * To apply this combined transformation to a vector, multiply
+ * the vector by the created matrix using \ref rsMatrixMultiply.
+ *
+ * @param m The matrix to modify.
+ * @param x The number to add to each x component.
+ * @param y The number to add to each y component.
+ * @param z The number to add to each z component.
  */
 extern void __attribute__((overloadable))
 rsMatrixTranslate(rs_matrix4x4 *m, float x, float y, float z);
 
 /**
- * Load an Ortho projection matrix constructed from the 6 planes
+ * Load an orthographic projection matrix.
  *
- * @param m
+ * Constructs an orthographic projection matrix, transforming the box
+ * identified by the six clipping planes <em>left, right, bottom, top,
+ * near, far</em> into a unit cube with a corner at
+ * <em>(-1, -1, -1)</em> and the opposite at <em>(1, 1, 1)</em>.
+ *
+ * To apply this projection to a vector, multiply the vector by the
+ * created matrix using \ref rsMatrixMultiply.
+ *
+ * See https://en.wikipedia.org/wiki/Orthographic_projection .
+ *
+ * @param m The matrix to set.
  * @param left
  * @param right
  * @param bottom
@@ -243,9 +361,16 @@
 rsMatrixLoadOrtho(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far);
 
 /**
- * Load an Frustum projection matrix constructed from the 6 planes
+ * Load a frustum projection matrix.
  *
- * @param m
+ * Constructs a frustum projection matrix, transforming the box
+ * identified by the six clipping planes <em>left, right, bottom, top,
+ * near, far</em>.
+ *
+ * To apply this projection to a vector, multiply the vector by the
+ * created matrix using \ref rsMatrixMultiply.
+ *
+ * @param m The matrix to set.
  * @param left
  * @param right
  * @param bottom
@@ -257,21 +382,36 @@
 rsMatrixLoadFrustum(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far);
 
 /**
- * Load an perspective projection matrix constructed from the 6 planes
+ * Load a perspective projection matrix.
  *
- * @param m
+ * Constructs a perspective projection matrix, assuming a symmetrical field of view.
+ *
+ * To apply this projection to a vector, multiply the vector by the
+ * created matrix using \ref rsMatrixMultiply.
+ *
+ * @param m The matrix to set.
  * @param fovy Field of view, in degrees along the Y axis.
  * @param aspect Ratio of x / y.
- * @param near
- * @param far
+ * @param near The near clipping plane.
+ * @param far The far clipping plane.
  */
 extern void __attribute__((overloadable))
 rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
 
 #if !defined(RS_VERSION) || (RS_VERSION < 14)
 /**
- * Multiply a vector by a matrix and return the result vector.
- * API version 10-13
+ * Multiply a vector by a matrix.
+ *
+ * Returns the post-multiplication of the vector by the matrix, ie. <em>m * in</em>.
+ *
+ * When multiplying a \e float3 to a \e rs_matrix4x4, the vector is expanded with (1).
+ *
+ * When multiplying a \e float2 to a \e rs_matrix4x4, the vector is expanded with (0, 1).
+ *
+ * When multiplying a \e float2 to a \e rs_matrix3x3, the vector is expanded with (0).
+ *
+ * This function is available in API version 10-13.  Starting with API 14,
+ * the function takes a const matrix as the first argument.
  */
 _RS_RUNTIME float4 __attribute__((overloadable))
 rsMatrixMultiply(rs_matrix4x4 *m, float4 in);
@@ -307,8 +447,17 @@
 rsMatrixMultiply(rs_matrix2x2 *m, float2 in);
 #else
 /**
- * Multiply a vector by a matrix and return the result vector.
- * API version 14+
+ * Multiply a vector by a matrix.
+ *
+ * Returns the post-multiplication of the vector of the matrix, i.e. <em>m * in</em>.
+ *
+ * When multiplying a \e float3 to a \e rs_matrix4x4, the vector is expanded with (1).
+ *
+ * When multiplying a \e float2 to a \e rs_matrix4x4, the vector is expanded with (0, 1).
+ *
+ * When multiplying a \e float2 to a \e rs_matrix3x3, the vector is expanded with (0).
+ *
+ * This function is available starting with API version 14.
  */
 _RS_RUNTIME float4 __attribute__((overloadable))
 rsMatrixMultiply(const rs_matrix4x4 *m, float4 in);
@@ -346,23 +495,28 @@
 
 
 /**
- * Returns true if the matrix was successfully inversed
+ * Inverts a matrix in place.
  *
- * @param m
+ * Returns true if the matrix was successfully inverted.
+ *
+ * @param m The matrix to invert.
  */
 extern bool __attribute__((overloadable)) rsMatrixInverse(rs_matrix4x4 *m);
 
 /**
- * Returns true if the matrix was successfully inversed and transposed.
+ * Inverts and transpose a matrix in place.
  *
- * @param m
+ * The matrix is first inverted then transposed.
+ * Returns true if the matrix was successfully inverted.
+ *
+ * @param m The matrix to modify.
  */
 extern bool __attribute__((overloadable)) rsMatrixInverseTranspose(rs_matrix4x4 *m);
 
 /**
- * Transpose the matrix m.
+ * Transpose the matrix m in place.
  *
- * @param m
+ * @param m The matrix to transpose.
  */
 extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix4x4 *m);
 /**
diff --git a/renderscript/include/rs_types.rsh b/renderscript/include/rs_types.rsh
index 33cd7da..f1fc60b 100644
--- a/renderscript/include/rs_types.rsh
+++ b/renderscript/include/rs_types.rsh
@@ -72,7 +72,11 @@
 /**
  * 64 bit integer type
  */
-typedef long long int64_t;
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+    typedef long int64_t;
+#else
+    typedef long long int64_t;
+#endif
 /**
  * 8 bit unsigned integer type
  */
@@ -88,7 +92,11 @@
 /**
  * 64 bit unsigned integer type
  */
-typedef unsigned long long uint64_t;
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+    typedef unsigned long uint64_t;
+#else
+    typedef unsigned long long uint64_t;
+#endif
 /**
  * 8 bit unsigned integer type
  */
diff --git a/renderscript/lib/arm/libRSSupport.so b/renderscript/lib/arm/libRSSupport.so
index 66f150e..c12750f 100755
--- a/renderscript/lib/arm/libRSSupport.so
+++ b/renderscript/lib/arm/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/arm/libc.so b/renderscript/lib/arm/libc.so
index 6011a39..04aee46 100755
--- a/renderscript/lib/arm/libc.so
+++ b/renderscript/lib/arm/libc.so
Binary files differ
diff --git a/renderscript/lib/arm/libclcore.bc b/renderscript/lib/arm/libclcore.bc
index 87197a6..34cbe63 100644
--- a/renderscript/lib/arm/libclcore.bc
+++ b/renderscript/lib/arm/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/arm/libm.so b/renderscript/lib/arm/libm.so
index ccaee56..01d9d4f 100755
--- a/renderscript/lib/arm/libm.so
+++ b/renderscript/lib/arm/libm.so
Binary files differ
diff --git a/renderscript/lib/arm/librsjni.so b/renderscript/lib/arm/librsjni.so
index 13c8b1b..f376df6 100755
--- a/renderscript/lib/arm/librsjni.so
+++ b/renderscript/lib/arm/librsjni.so
Binary files differ
diff --git a/renderscript/lib/arm/librsrt_arm.bc b/renderscript/lib/arm/librsrt_arm.bc
index db86347..34cbe63 100644
--- a/renderscript/lib/arm/librsrt_arm.bc
+++ b/renderscript/lib/arm/librsrt_arm.bc
Binary files differ
diff --git a/renderscript/lib/javalib.jar b/renderscript/lib/javalib.jar
index 6d32d89..47a085c 100644
--- a/renderscript/lib/javalib.jar
+++ b/renderscript/lib/javalib.jar
Binary files differ
diff --git a/renderscript/lib/mips/libRSSupport.so b/renderscript/lib/mips/libRSSupport.so
index e64fd7d..d195cb7 100755
--- a/renderscript/lib/mips/libRSSupport.so
+++ b/renderscript/lib/mips/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/mips/libc.so b/renderscript/lib/mips/libc.so
index 482e164..e3613f6 100755
--- a/renderscript/lib/mips/libc.so
+++ b/renderscript/lib/mips/libc.so
Binary files differ
diff --git a/renderscript/lib/mips/libclcore.bc b/renderscript/lib/mips/libclcore.bc
index 87197a6..34cbe63 100644
--- a/renderscript/lib/mips/libclcore.bc
+++ b/renderscript/lib/mips/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/mips/libm.so b/renderscript/lib/mips/libm.so
index 2e0680c..2d989a2 100755
--- a/renderscript/lib/mips/libm.so
+++ b/renderscript/lib/mips/libm.so
Binary files differ
diff --git a/renderscript/lib/mips/librsjni.so b/renderscript/lib/mips/librsjni.so
index 3d2a607..54e0e11 100755
--- a/renderscript/lib/mips/librsjni.so
+++ b/renderscript/lib/mips/librsjni.so
Binary files differ
diff --git a/renderscript/lib/mips/librsrt_mips.bc b/renderscript/lib/mips/librsrt_mips.bc
index db86347..34cbe63 100644
--- a/renderscript/lib/mips/librsrt_mips.bc
+++ b/renderscript/lib/mips/librsrt_mips.bc
Binary files differ
diff --git a/renderscript/lib/x86/libRSSupport.so b/renderscript/lib/x86/libRSSupport.so
index 41ae99e..a50fbd9 100755
--- a/renderscript/lib/x86/libRSSupport.so
+++ b/renderscript/lib/x86/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/x86/libc.so b/renderscript/lib/x86/libc.so
index fb72c43..fb51f4f 100755
--- a/renderscript/lib/x86/libc.so
+++ b/renderscript/lib/x86/libc.so
Binary files differ
diff --git a/renderscript/lib/x86/libclcore.bc b/renderscript/lib/x86/libclcore.bc
index b537f66..76ebb47 100644
--- a/renderscript/lib/x86/libclcore.bc
+++ b/renderscript/lib/x86/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/x86/libm.so b/renderscript/lib/x86/libm.so
index fd71ce6..3b4c732 100755
--- a/renderscript/lib/x86/libm.so
+++ b/renderscript/lib/x86/libm.so
Binary files differ
diff --git a/renderscript/lib/x86/librsjni.so b/renderscript/lib/x86/librsjni.so
index eb2bd79..5a5bb7f 100755
--- a/renderscript/lib/x86/librsjni.so
+++ b/renderscript/lib/x86/librsjni.so
Binary files differ
diff --git a/renderscript/lib/x86/librsrt_x86.bc b/renderscript/lib/x86/librsrt_x86.bc
index 5974932..7390573 100644
--- a/renderscript/lib/x86/librsrt_x86.bc
+++ b/renderscript/lib/x86/librsrt_x86.bc
Binary files differ
diff --git a/tools/linux/bcc_compat b/tools/linux/bcc_compat
index cda5dcd..20349d0 100755
--- a/tools/linux/bcc_compat
+++ b/tools/linux/bcc_compat
Binary files differ
diff --git a/tools/linux/libLLVM.so b/tools/linux/libLLVM.so
index 224017a..cea59fc 100755
--- a/tools/linux/libLLVM.so
+++ b/tools/linux/libLLVM.so
Binary files differ
diff --git a/tools/linux/libbcc.so b/tools/linux/libbcc.so
index 0f2528d..85f3d8d 100755
--- a/tools/linux/libbcc.so
+++ b/tools/linux/libbcc.so
Binary files differ
diff --git a/tools/linux/libbcinfo.so b/tools/linux/libbcinfo.so
index 00e9236..5dadd1d 100755
--- a/tools/linux/libbcinfo.so
+++ b/tools/linux/libbcinfo.so
Binary files differ
diff --git a/tools/linux/libc++.so b/tools/linux/libc++.so
index 905d321..b305c82 100755
--- a/tools/linux/libc++.so
+++ b/tools/linux/libc++.so
Binary files differ
diff --git a/tools/linux/libclang.so b/tools/linux/libclang.so
index d63dc84..a225c6b 100755
--- a/tools/linux/libclang.so
+++ b/tools/linux/libclang.so
Binary files differ
diff --git a/tools/linux/llvm-rs-cc b/tools/linux/llvm-rs-cc
index 5546976..eb19d9c 100755
--- a/tools/linux/llvm-rs-cc
+++ b/tools/linux/llvm-rs-cc
Binary files differ