am 9e7e1243: am 17795736: am 4cc3c4d3: Merge "cpu_ref: fix c++11 narrowing violations"

* commit '9e7e124326cf4c0a20709f313d290fcfecc4f3de':
  cpu_ref: fix c++11 narrowing violations
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 4c9c547..661ff73 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -45,6 +45,12 @@
 #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/*/src/RenderScript.stamp)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/*/src/renderscript/)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/*/src/renderscript)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/*/src/renderscript)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/*/src/RenderScript.stamp)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/*/src/RenderScript.stamp)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/obj/SHARED_LIBRARIES/lib*.bc_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/obj/SHARED_LIBRARIES/librs*_intermediates)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/api/gen_runtime.cpp b/api/gen_runtime.cpp
new file mode 100644
index 0000000..cdfdf5d
--- /dev/null
+++ b/api/gen_runtime.cpp
@@ -0,0 +1,450 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <vector>
+#include <list>
+#include <string>
+
+using namespace std;
+
+FILE *gIn;
+FILE *gOut;
+
+class Func {
+public:
+    Func() {
+        mMinVersion = 0;
+        mMaxVersion = 0;
+    }
+
+    string mName;
+    int mMinVersion;
+    int mMaxVersion;
+
+    vector<vector<string> > mReplaceables;
+    vector<string> mArgs;
+    string mRet;
+    vector<string> mComment;
+    vector<string> mInline;
+
+};
+
+vector<Func *> gFuncs;
+
+bool getNextLine(FILE *in, string *s) {
+    s->clear();
+    while (1) {
+        int c = fgetc(in);
+        if (c == EOF) return s->size() != 0;
+        if (c == '\n') break;
+        s->push_back((char)c);
+    }
+    return true;
+}
+
+void trim(string *s, size_t start) {
+    if (start > 0) {
+        s->erase(0, start);
+    }
+
+    while (s->size() && (s->at(0) == ' ')) {
+        s->erase(0, 1);
+    }
+
+    size_t p = s->find_first_of("\n\r");
+    if (p != string::npos) {
+        s->erase(p);
+    }
+
+    while ((s->size() > 0) && (s->at(s->size()-1) == ' ')) {
+        s->erase(s->size() -1);
+    }
+}
+
+Func * scanFunction(FILE *in) {
+    Func *f = new Func();
+    bool modeComment = false;
+    bool modeInline = false;
+    size_t replacables = 0;
+
+    while (1) {
+        string s;
+        bool ret = getNextLine(in, &s);
+        if (!ret) break;
+
+        if (modeComment) {
+            if (!s.size() || (s[0] == ' ')) {
+                trim(&s, 0);
+                f->mComment.push_back(s);
+                continue;
+            } else {
+                modeComment = false;
+            }
+        }
+
+        if (modeInline) {
+            if (!s.size() || (s[0] == ' ')) {
+                trim(&s, 0);
+                f->mInline.push_back(s);
+                continue;
+            } else {
+                modeInline = false;
+            }
+        }
+
+        if (s[0] == '#') {
+            continue;
+        }
+
+        if (s.compare(0, 5, "name:") == 0) {
+            trim(&s, 5);
+            f->mName = s;
+            continue;
+        }
+
+        if (s.compare(0, 4, "arg:") == 0) {
+            trim(&s, 4);
+            f->mArgs.push_back(s);
+            continue;
+        }
+
+        if (s.compare(0, 4, "ret:") == 0) {
+            trim(&s, 4);
+            f->mRet = s;
+            continue;
+        }
+
+        if (s.compare(0, 4, "end:") == 0) {
+            return f;
+        }
+
+        if (s.compare(0, 8, "comment:") == 0) {
+            modeComment = true;
+            continue;
+        }
+
+        if (s.compare(0, 7, "inline:") == 0) {
+            modeInline = true;
+            continue;
+        }
+
+        if (s.compare(0, 8, "version:") == 0) {
+            trim(&s, 8);
+            sscanf(s.c_str(), "%i %i", &f->mMinVersion, &f->mMaxVersion);
+            continue;
+        }
+
+        if (s.compare(0, 8, "start:") == 0) {
+            continue;
+        }
+
+        if (s.compare(0, 2, "w:") == 0) {
+            vector<string> t;
+            if (s.find("1") != string::npos) {
+                t.push_back("");
+            }
+            if (s.find("2") != string::npos) {
+                t.push_back("2");
+            }
+            if (s.find("3") != string::npos) {
+                t.push_back("3");
+            }
+            if (s.find("4") != string::npos) {
+                t.push_back("4");
+            }
+            f->mReplaceables.push_back(t);
+            continue;
+        }
+
+        if (s.compare(0, 2, "t:") == 0) {
+            vector<string> t;
+            if (s.find("f16") != string::npos) {
+                t.push_back("half");
+            }
+            if (s.find("f32") != string::npos) {
+                t.push_back("float");
+            }
+            if (s.find("f64") != string::npos) {
+                t.push_back("double");
+            }
+            if (s.find("i8") != string::npos) {
+                t.push_back("char");
+            }
+            if (s.find("u8") != string::npos) {
+                t.push_back("uchar");
+            }
+            if (s.find("i16") != string::npos) {
+                t.push_back("short");
+            }
+            if (s.find("u16") != string::npos) {
+                t.push_back("ushort");
+            }
+            if (s.find("i32") != string::npos) {
+                t.push_back("int");
+            }
+            if (s.find("u32") != string::npos) {
+                t.push_back("uint");
+            }
+            if (s.find("i64") != string::npos) {
+                t.push_back("long");
+            }
+            if (s.find("u64") != string::npos) {
+                t.push_back("ulong");
+            }
+            f->mReplaceables.push_back(t);
+            continue;
+        }
+
+        if (s.size() == 0) {
+            // eat empty line
+            continue;
+        }
+
+        printf("Error, line:\n");
+        printf("  %s\n", s.c_str());
+    }
+
+    delete f;
+    return NULL;
+}
+
+string stringReplace(string s, string match, string rep) {
+    while(1) {
+        size_t p = s.find(match);
+        if (p == string::npos) break;
+
+        s.erase(p, match.size());
+        s.insert(p, rep);
+    }
+    return s;
+}
+
+string stringExpand(string s, const Func *f, int i1, int i2, int i3, int i4) {
+    if (f->mReplaceables.size() > 0) {
+        s = stringReplace(s, "#1", f->mReplaceables[0][i1]);
+    }
+    if (f->mReplaceables.size() > 1) {
+        s = stringReplace(s, "#2", f->mReplaceables[1][i2]);
+    }
+    if (f->mReplaceables.size() > 2) {
+        s = stringReplace(s, "#3", f->mReplaceables[2][i3]);
+    }
+    if (f->mReplaceables.size() > 3) {
+        s = stringReplace(s, "#4", f->mReplaceables[3][i4]);
+    }
+    return s;
+}
+
+void writeLegal(FILE *o) {
+    fprintf(o, "/*\n");
+    fprintf(o, " * Copyright (C) 2014 The Android Open Source Project\n");
+    fprintf(o, " *\n");
+    fprintf(o, " * Licensed under the Apache License, Version 2.0 (the \"License\");\n");
+    fprintf(o, " * you may not use this file except in compliance with the License.\n");
+    fprintf(o, " * You may obtain a copy of the License at\n");
+    fprintf(o, " *\n");
+    fprintf(o, " *      http://www.apache.org/licenses/LICENSE-2.0\n");
+    fprintf(o, " *\n");
+    fprintf(o, " * Unless required by applicable law or agreed to in writing, software\n");
+    fprintf(o, " * distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+    fprintf(o, " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+    fprintf(o, " * See the License for the specific language governing permissions and\n");
+    fprintf(o, " * limitations under the License.\n");
+    fprintf(o, " */\n\n");
+}
+
+void writeIfdef(FILE *o, string filename, bool isStart) {
+    string t = "__";
+    t += filename;
+    t += "__";
+
+    for (size_t i = 2; i < t.size(); i++) {
+        if (t[i] == '.') {
+            t[i] = '_';
+        }
+    }
+
+    if (isStart) {
+        fprintf(o, "#ifndef %s\n", t.c_str());
+        fprintf(o, "#define %s\n", t.c_str());
+    } else {
+        fprintf(o, "#endif // %s\n", t.c_str());
+    }
+}
+
+
+
+void writeHeaderFunc(FILE *o, const Func *f, int i1, int i2, int i3, int i4) {
+    string s;
+
+    if (f->mMinVersion || f->mMaxVersion) {
+        if (f->mMaxVersion) {
+            fprintf(o, "#if (defined(RS_VERSION) && (RS_VERSION >= %i) && (RS_VERSION <= %i))\n",
+                    f->mMinVersion, f->mMaxVersion);
+        } else {
+            fprintf(o, "#if (defined(RS_VERSION) && (RS_VERSION >= %i))\n",
+                    f->mMinVersion);
+        }
+    }
+
+    fprintf(o, "/*\n");
+    for (size_t ct=0; ct < f->mComment.size(); ct++) {
+        s = stringExpand(f->mComment[ct], f, i1, i2, i3, i4);
+        if (s.size()) {
+            fprintf(o, " * %s\n", s.c_str());
+        } else {
+            fprintf(o, " *\n");
+        }
+    }
+    fprintf(o, " *\n");
+    if (f->mMinVersion || f->mMaxVersion) {
+        if (f->mMaxVersion) {
+            fprintf(o, " * Suppored by API versions %i - %i\n",
+                    f->mMinVersion, f->mMaxVersion);
+        } else {
+            fprintf(o, " * Supported by API versions %i and newer.\n",
+                    f->mMinVersion);
+        }
+    }
+
+    fprintf(o, " */\n");
+
+    s.clear();
+    if (f->mInline.size() > 0) {
+        s += "static ";
+    } else {
+        s += "extern ";
+    }
+    s += f->mRet;
+    s += " __attribute__((const, overloadable))";
+    s += f->mName;
+    s += "(";
+    if (f->mArgs.size()) {
+        s += f->mArgs[0];
+    }
+    for (size_t ct=1; ct < f->mArgs.size(); ct++) {
+        s += ", ";
+        s += f->mArgs[ct];
+    }
+    if (f->mInline.size() > 0) {
+        s += ") {";
+    } else {
+        s += ");";
+    }
+    s = stringExpand(s, f, i1, i2, i3, i4);
+    fprintf(o, "%s\n", s.c_str());
+
+    if (f->mInline.size() > 0) {
+        for (size_t ct=0; ct < f->mInline.size(); ct++) {
+            s = stringExpand(f->mInline[ct], f, i1, i2, i3, i4);
+            fprintf(o, " %s\n", s.c_str());
+        }
+        fprintf(o, "}\n");
+    }
+
+    if (f->mMinVersion || f->mMaxVersion) {
+        fprintf(o, "#endif\n");
+    }
+
+    fprintf(o, "\n", s.c_str());
+}
+
+
+void writeHeaderFuncs(FILE *o, const Func *f) {
+    switch(f->mReplaceables.size()) {
+    case 0:
+        writeHeaderFunc(o, f, -1, -1, -1, -1);
+        break;
+    case 1:
+        for (size_t i1 = 0; i1 < f->mReplaceables[0].size(); i1++) {
+            writeHeaderFunc(o, f, i1, -1, -1, -1);
+        }
+        break;
+    case 2:
+        for (size_t i2 = 0; i2 < f->mReplaceables[1].size(); i2++) {
+            for (size_t i1 = 0; i1 < f->mReplaceables[0].size(); i1++) {
+                writeHeaderFunc(o, f, i1, i2, -1, -1);
+            }
+        }
+        break;
+    case 3:
+        for (size_t i3 = 0; i3 < f->mReplaceables[2].size(); i3++) {
+            for (size_t i2 = 0; i2 < f->mReplaceables[1].size(); i2++) {
+                for (size_t i1 = 0; i1 < f->mReplaceables[0].size(); i1++) {
+                    writeHeaderFunc(o, f, i1, i2, i3, -1);
+                }
+            }
+        }
+        break;
+    case 4:
+        for (size_t i4 = 0; i4 < f->mReplaceables[3].size(); i4++) {
+            for (size_t i3 = 0; i3 < f->mReplaceables[2].size(); i3++) {
+                for (size_t i2 = 0; i2 < f->mReplaceables[1].size(); i2++) {
+                    for (size_t i1 = 0; i1 < f->mReplaceables[0].size(); i1++) {
+                        writeHeaderFunc(o, f, i1, i2, i3, i4);
+                    }
+                }
+            }
+        }
+        break;
+    }
+}
+
+
+
+int main(int argc, char* argv[])
+{
+    const char *inpath = "runtime.spec";
+    const char *outpath = "rs_core_math.rsh";
+
+    gIn = fopen(inpath, "rt");
+    if (!gIn) {
+        printf("Error opening input file: %s", inpath);
+        return -1;
+    }
+
+    while (1) {
+        Func *f = scanFunction(gIn);
+        if (f != NULL) {
+            gFuncs.push_back(f);
+        } else {
+            break;
+        }
+    }
+
+    gOut = fopen(outpath, "wt");
+    if (!gOut) {
+        printf("Error opening output file: %s", outpath);
+        return -1;
+    }
+
+    writeLegal(gOut);
+    writeIfdef(gOut, outpath, true);
+    for (size_t ct=0; ct < gFuncs.size(); ct++) {
+        writeHeaderFuncs(gOut, gFuncs[ct]);
+    }
+    writeIfdef(gOut, outpath, false);
+
+    fclose (gIn);
+    fclose (gOut);
+
+    printf("%i Functions processed.\n", (int)gFuncs.size());
+
+    return 0;
+}
+
+
diff --git a/api/runtime.spec b/api/runtime.spec
new file mode 100644
index 0000000..279d67f
--- /dev/null
+++ b/api/runtime.spec
@@ -0,0 +1,1439 @@
+#
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+start:
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+name: convert_#3#1
+arg: #2#1
+ret: #3#1
+comment:
+ Component wise conversion from #2#1 to #3#1
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: acos
+ret: #2#1
+arg: #2#1
+comment:
+ acos
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: acosh
+ret: #2#1
+arg: #2#1
+comment:
+ acosh
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: acospi
+ret: #2#1
+arg: #2#1
+comment:
+ acospi
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: asin
+ret: #2#1
+arg: #2#1
+comment:
+ asin
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: asinh
+ret: #2#1
+arg: #2#1
+comment:
+ asinh
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: asinpi
+ret: #2#1
+arg: #2#1
+comment:
+ Return the inverse sine divided by PI.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: atan
+ret: #2#1
+arg: #2#1
+comment:
+ Return the inverse tangent.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: atan2
+ret: #2#1
+arg: #2#1 y
+arg: #2#1 x
+comment:
+ Return the inverse tangent of y / x.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: atanh
+ret: #2#1
+arg: #2#1
+comment:
+ Return the inverse hyperbolic tangent.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: atanpi
+ret: #2#1
+arg: #2#1
+comment:
+ Return the inverse tangent divided by PI.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: atan2pi
+ret: #2#1
+arg: #2#1 y
+arg: #2#1 x
+comment:
+ Return the inverse tangent of y / x, divided by PI.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: cbrt
+ret: #2#1
+arg: #2#1
+comment:
+ Return the cube root.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: ceil
+ret: #2#1
+arg: #2#1
+comment:
+ Return the smallest integer not less than a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: copysign
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Copy the sign bit from y to x.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: cos
+ret: #2#1
+arg: #2#1
+comment:
+ Return the cosine.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: cosh
+ret: #2#1
+arg: #2#1
+comment:
+ Return the hypebolic cosine.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: cospi
+ret: #2#1
+arg: #2#1
+comment:
+ Return the cosine of the value * PI.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: erfc
+ret: #2#1
+arg: #2#1
+comment:
+ Return the complementary error function.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: erf
+ret: #2#1
+arg: #2#1
+comment:
+ Return the error function.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: exp
+ret: #2#1
+arg: #2#1
+comment:
+ Return e ^ value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: exp2
+ret: #2#1
+arg: #2#1
+comment:
+ Return 2 ^ value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: exp10
+ret: #2#1
+arg: #2#1
+comment:
+ Return 10 ^ value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: expm1
+ret: #2#1
+arg: #2#1
+comment:
+ Return (e ^ value) - 1.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fabs
+ret: #2#1
+arg: #2#1
+comment:
+ Return the absolute value of a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fdim
+ret: #2#1
+arg: #2#1
+arg: #2#1
+comment:
+ Return the positive difference between two values.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: floor
+ret: #2#1
+arg: #2#1
+comment:
+ Return the smallest integer not greater than a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fma
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+arg: #2#1 c
+comment:
+ Return (a * b) + c.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fmax
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return (x < y ? y : x)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fmax
+ret: #2#1
+arg: #2#1 x
+arg: #2 y
+comment:
+ Return (x < y ? y : x)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fmin
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return (x > y ? y : x)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fmin
+ret: #2#1
+arg: #2#1 x
+arg: #2 y
+comment:
+ Return (x > y ? y : x)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fmod
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return the remainder from x / y
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fract
+ret: #2#1
+arg: #2#1 v
+arg: #2#1 *iptr
+comment:
+ Return fractional part of v
+
+ @param iptr  iptr[0] will be set to the floor of the input value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fract
+ret: #2#1
+arg: #2#1 v
+comment:
+ Return fractional part of v
+inline:
+    #2#1 unused;
+    return fract(v, &unused);
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: frexp
+ret: #2#1
+arg: #2#1 v
+arg: int#1 *iptr
+comment:
+ Return the mantissa and place the exponent into iptr[0]
+
+ @param v Supports float, float2, float3, float4.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: hypot
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return sqrt(x*x + y*y)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: ilogb
+ret: int#1
+arg: float#1
+comment:
+ Return the integer exponent of a value
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: ilogb
+ret: #2#1
+arg: #2#1
+arg: int#1
+comment:
+ Return (x * 2^y)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: ilogb
+ret: #2#1
+arg: #2#1
+arg: int
+comment:
+ Return (x * 2^y)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+name: ldexp
+ret: float#1
+arg: float#1 x
+arg: int#1 y
+comment:
+ Return (x * 2^y)
+
+ @param x Supports 1,2,3,4 components
+ @param y Supports single component or matching vector.
+version: 9
+end:
+
+start:
+w: 2, 3, 4
+name: ldexp
+ret: float#1
+arg: float#1 x
+arg: int y
+comment:
+ Return (x * 2^y)
+
+ @param x Supports 1,2,3,4 components
+ @param y Supports single component or matching vector.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: lgamma
+ret: #2#1
+arg: #2#1 x
+comment:
+ Return the log gamma and sign
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: lgamma
+ret: #2#1
+arg: #2#1 x
+arg: int#1 *y
+comment:
+ Return the log gamma and sign
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: log
+ret: #2#1
+arg: #2#1 x
+comment:
+ Return the natural logarithm.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: log2
+ret: #2#1
+arg: #2#1 x
+comment:
+ Return the base 2 logarithm.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: log10
+ret: #2#1
+arg: #2#1 x
+comment:
+ Return the base 10 logarithm.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: log1p
+ret: #2#1
+arg: #2#1 x
+comment:
+ Return the natural logarithm of (v + 1.0f)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: logb
+ret: #2#1
+arg: #2#1 x
+comment:
+ Compute the exponent of the value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: mad
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+arg: #2#1 c
+comment:
+ Compute (a * b) + c
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: modf
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 *iret
+comment:
+ Return the integral and fractional components of a number.
+
+ @param x Source value
+ @param iret iret[0] will be set to the integral portion of the number.
+ @return The floating point portion of the value.
+version: 9
+end:
+
+start:
+w: 1
+t: f32
+name: nan
+ret: #2#1
+arg: uint#1
+comment:
+ generate a nan
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: nextafter
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return the next floating point number from x towards y.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: pow
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return x ^ y.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: pown
+ret: #2#1
+arg: #2#1 x
+arg: int#1 y
+comment:
+ Return x ^ y.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: powr
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return x ^ y.
+ y must be > 0
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: remainder
+ret: #2#1
+arg: #2#1 x
+arg: #2#1 y
+comment:
+ Return round x/y to the nearest integer then compute the remander.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: remquo
+ret: #2#1
+arg: #2#1
+arg: #2#1
+arg: int#1 *
+comment:
+ todo
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: rint
+ret: #2#1
+arg: #2#1
+comment:
+ Round to the nearest integral value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: rootn
+ret: #2#1
+arg: #2#1 v
+arg: int#1 n
+comment:
+ Compute the Nth root of a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: round
+ret: #2#1
+arg: #2#1
+comment:
+ Round to the nearest integral value.  Half values are rounded away from zero.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: rsqrt
+ret: #2#1
+arg: #2#1
+comment:
+ Return (1 / sqrt(value)).
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: sqrt
+ret: #2#1
+arg: #2#1
+comment:
+ Return the square root of a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: sin
+ret: #2#1
+arg: #2#1
+comment:
+ Return the sine of a value specified in radians.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: sincos
+ret: #2#1
+arg: #2#1 v
+arg: #2#1 *cosptr
+comment:
+ Return the sine and cosine of a value.
+
+ @return sine
+ @param v The incoming value in radians
+ @param *cosptr cosptr[0] will be set to the cosine value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: sinh
+ret: #2#1
+arg: #2#1
+comment:
+ Return the hyperbolic sine of a value specified in radians.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: sinpi
+ret: #2#1
+arg: #2#1
+comment:
+ Return the sin(v * PI).
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: tan
+ret: #2#1
+arg: #2#1
+comment:
+ Return the tangent of a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: tanh
+ret: #2#1
+arg: #2#1
+comment:
+ Return the hyperbolic tangent of a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: tanpi
+ret: #2#1
+arg: #2#1
+comment:
+ Return tan(v * PI)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: tgamma
+ret: #2#1
+arg: #2#1
+comment:
+ Compute the gamma function of a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: trunc
+ret: #2#1
+arg: #2#1
+comment:
+ ound to integral using truncation.
+version: 9
+end:
+
+# int functions
+
+start:
+w: 1, 2, 3, 4
+t: i8, i16, i32
+name: abs
+ret: u#2#1
+arg: #2#1 value
+comment:
+ Return the absolute value of a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: u8, u16, u32, i8, i16, i32
+name: clz
+ret: #2#1
+arg: #2#1 value
+comment:
+ Return the number of leading 0-bits in a value.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: min
+ret: #2#1
+arg: #2#1
+arg: #2#1
+comment:
+ Return the minimum value from two arguments
+version: 9
+end:
+
+start:
+w: 1
+t: i8 i16 i32 u8 u16 u32
+name: min
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the minimum value from two arguments
+inline:
+ return (v1 < v2 ? v1 : v2);
+version: 9 19
+end:
+
+start:
+w: 2
+t: i8 i16 i32 u8 u16 u32
+name: min
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the minimum value from two arguments
+inline:
+ #2#1 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ return tmp;
+version: 9 19
+end:
+
+start:
+w: 3
+t: i8 i16 i32 u8 u16 u32
+name: min
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the minimum value from two arguments
+inline:
+ #2#1 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ return tmp;
+version: 9 19
+end:
+
+start:
+w: 4
+t: i8 i16 i32 u8 u16 u32
+name: min
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the minimum value from two arguments
+inline:
+ #2#1 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w < v2.w ? v1.w : v2.w);
+ return tmp;
+version: 9 19
+end:
+
+start:
+w: 1, 2, 3, 4
+t: i8 i16 i32 i64 u8 u16 u32 u64
+name: min
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the minimum value from two arguments
+version: 20
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: max
+ret: #2#1
+arg: #2#1
+arg: #2#1
+comment:
+ Return the maximum value from two arguments
+version: 9
+end:
+
+start:
+w: 1
+t: i8 i16 i32 u8 u16 u32
+name: max
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the maximum value from two arguments
+inline:
+ return (v1 > v2 ? v1 : v2);
+version: 9 19
+end:
+
+start:
+w: 2
+t: i8 i16 i32 u8 u16 u32
+name: max
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the maximum value from two arguments
+inline:
+ #2#1 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ return tmp;
+version: 9 19
+end:
+
+start:
+w: 3
+t: i8 i16 i32 u8 u16 u32
+name: max
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the maximum value from two arguments
+inline:
+ #2#1 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ return tmp;
+version: 9 19
+end:
+
+start:
+w: 4
+t: i8 i16 i32 u8 u16 u32
+name: max
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the maximum value from two arguments
+inline:
+ #2#1 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w > v2.w ? v1.w : v2.w);
+ return tmp;
+version: 9 19
+end:
+
+start:
+w: 1, 2, 3, 4
+t: i8 i16 i32 i64 u8 u16 u32 u64
+name: max
+ret: #2#1
+arg: #2#1 v1
+arg: #2#1 v2
+comment:
+ Return the maximum value from two arguments
+version: 20
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: clamp
+ret: #2#1
+arg: #2#1 value
+arg: #2#1 min_value
+arg: #2#1 max_value
+comment:
+ Clamp a value to a specified high and low bound.
+
+ @param amount value to be clamped.  Supports 1,2,3,4 components
+ @param min_value Lower bound, must be scalar or matching vector.
+ @param max_value High bound, must match type of low
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: clamp
+ret: #2#1
+arg: #2#1 value
+arg: #2 min_value
+arg: #2 max_value
+comment:
+ Clamp a value to a specified high and low bound.
+
+ @param amount value to be clamped.  Supports 1,2,3,4 components
+ @param min_value Lower bound, must be scalar or matching vector.
+ @param max_value High bound, must match type of low
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64
+name: clamp
+ret: #2#1
+arg: #2#1 value
+arg: #2#1 min_value
+arg: #2#1 max_value
+comment:
+ Clamp a value to a specified high and low bound.
+
+ @param amount value to be clamped.  Supports 1,2,3,4 components
+ @param min_value Lower bound, must be scalar or matching vector.
+ @param max_value High bound, must match type of low
+version: 19
+end:
+
+start:
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64
+name: clamp
+ret: #2#1
+arg: #2#1 value
+arg: #2 min_value
+arg: #2 max_value
+comment:
+ Clamp a value to a specified high and low bound.
+
+ @param amount value to be clamped.  Supports 1,2,3,4 components
+ @param min_value Lower bound, must be scalar or matching vector.
+ @param max_value High bound, must match type of low
+version: 19
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: degrees
+ret: #2#1
+arg: #2#1 value
+comment:
+ Convert from radians to degrees.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: mix
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2#1 amount
+comment:
+ return start + ((stop - start) * amount)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: mix
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2 amount
+comment:
+ return start + ((stop - start) * amount)
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: radians
+ret: #2#1
+arg: #2#1 value
+comment:
+ Convert from degrees to radians.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: step
+ret: #2#1
+arg: #2#1 edge
+arg: #2#1 v
+comment:
+ if (v < edge)
+     return 0.f;
+ else
+     return 1.f;
+version: 9
+end:
+
+start:
+w: 2, 3, 4
+t: f32
+name: step
+ret: #2#1
+arg: #2#1 edge
+arg: #2 v
+comment:
+ if (v < edge)
+     return 0.f;
+ else
+     return 1.f;
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: sign
+ret: #2#1
+arg: #2#1 v
+comment:
+ Return the sign of a value.
+
+ if (v < 0) return -1.f;
+ else if (v > 0) return 1.f;
+ else return 0.f;
+version: 9
+end:
+
+start:
+w: 3, 4
+t: f32
+name: cross
+ret: #2#1
+arg: #2#1 lhs
+arg: #2#1 rhs
+comment:
+ Compute the cross product of two vectors.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: dot
+ret: #2
+arg: #2#1 lhs
+arg: #2#1 rhs
+comment:
+ Compute the dot product of two vectors.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: length
+ret: #2
+arg: #2#1 v
+comment:
+ Compute the length of a vector.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: distance
+ret: #2
+arg: #2#1 lhs
+arg: #2#1 rhs
+comment:
+ Compute the distance between two points.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: normalize
+ret: #2#1
+arg: #2#1 v
+comment:
+ Normalize a vector.
+version: 9
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: half_recip
+ret: #2#1
+arg: #2#1 v
+comment:
+ Return the approximate reciprocal of a value.
+version: 17
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: half_sqrt
+ret: #2#1
+arg: #2#1 v
+comment:
+ Return the approximate square root of a value.
+version: 17
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: half_rsqrt
+ret: #2#1
+arg: #2#1 v
+comment:
+ Return the approximate value of (1.f / sqrt(value)).
+version: 17
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fast_length
+ret: #2
+arg: #2#1 v
+comment:
+ Compute the approximate length of a vector.
+version: 17
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fast_distance
+ret: #2
+arg: #2#1 lhs
+arg: #2#1 rhs
+comment:
+ Compute the approximate distance between two points.
+version: 17
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: fast_normalize
+ret: #2#1
+arg: #2#1 v
+comment:
+ Approximately normalize a vector.
+version: 17
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: native_exp
+ret: #2#1
+arg: #2#1 v
+comment:
+ Fast approximate exp
+ valid for inputs -86.f to 86.f
+ Max 8192 ulps of error
+version: 18
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: native_exp2
+ret: #2#1
+arg: #2#1 v
+comment:
+ Fast approximate exp2
+ valid for inputs -125.f to 125.f
+ Max 8192 ulps of error
+version: 18
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: native_exp10
+ret: #2#1
+arg: #2#1 v
+comment:
+ Fast approximate exp10
+ valid for inputs -37.f to 37.f
+ Max 8192 ulps of error
+version: 18
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: native_log
+ret: #2#1
+arg: #2#1 v
+comment:
+ Fast approximate log
+version: 18
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: native_log2
+ret: #2#1
+arg: #2#1 v
+comment:
+ Fast approximate log2
+version: 18
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: native_log10
+ret: #2#1
+arg: #2#1 v
+comment:
+ Fast approximate log10
+version: 18
+end:
+
+start:
+w: 1, 2, 3, 4
+t: f32
+name: native_powr
+ret: #2#1
+arg: #2#1 v
+arg: #2#1 y
+comment:
+ Fast approximate v ^ y
+version: 18
+end:
+
+
diff --git a/cpp/Android.mk b/cpp/Android.mk
index 9ed02fb..a5d6a69 100644
--- a/cpp/Android.mk
+++ b/cpp/Android.mk
@@ -21,9 +21,11 @@
   RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))"
 endif
 local_cflags_for_rs_cpp += -DRS_VERSION=$(RS_VERSION)
+local_cflags_for_rs_cpp += -Wno-unused-parameter
 
 LOCAL_SRC_FILES := $(rs_cpp_SRC_FILES)
 
+LOCAL_CLANG := true
 LOCAL_CFLAGS += $(local_cflags_for_rs_cpp)
 
 LOCAL_SHARED_LIBRARIES := \
@@ -47,6 +49,7 @@
 
 include $(CLEAR_VARS)
 
+LOCAL_CLANG := true
 LOCAL_CFLAGS += $(local_cflags_for_rs_cpp)
 
 LOCAL_SDK_VERSION := 8
diff --git a/java/Android.mk b/java/Android.mk
index 6145a3d..c8f64ce 100644
--- a/java/Android.mk
+++ b/java/Android.mk
@@ -1,3 +1,7 @@
 LOCAL_PATH:=$(call my-dir)
 
+# Only build our tests if we doing a top-level build. Do not build the
+# tests if we are just doing an mm or mmm in frameworks/rs.
+ifeq (,$(ONE_SHOT_MAKEFILE))
 include $(call all-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/java/tests/Balls/src/com/example/android/rs/balls/ball_physics.rs b/java/tests/Balls/src/com/example/android/rs/balls/ball_physics.rs
index 5b5d2e0..a8c781d 100644
--- a/java/tests/Balls/src/com/example/android/rs/balls/ball_physics.rs
+++ b/java/tests/Balls/src/com/example/android/rs/balls/ball_physics.rs
@@ -60,11 +60,11 @@
             float2 vec2 = vec * vec;
             float len2 = vec2.x + vec2.y;
 
-            if ((len2 < 10000.f) && (len2 > 0.f)) {
-                float t = native_powr(len2, 1.5f) + 16.0f;
-                float2 pfv = (vec / t) * 16000.f;
-                pressure += length(pfv);
-                fv -= pfv;
+            if ((len2 < 10000.f) && (len2 > 0.001f)) {
+                float len = rsqrt(len2 + 4.f);
+                float f = (len * len * len) * 20000.f;
+                fv -= vec * f;
+                pressure += f;
             }
         }
     }
@@ -137,7 +137,7 @@
     }
 
     // low pressure ~500, high ~2500
-    pressure = max(pressure - 400.f, 0.f);
+    pressure *= 12.f;
     ball->pressure = pressure;
 
     //rsDebug("p ", pressure);
diff --git a/java/tests/Balls/src/com/example/android/rs/balls/balls.rs b/java/tests/Balls/src/com/example/android/rs/balls/balls.rs
index 9be9f38..077916d 100644
--- a/java/tests/Balls/src/com/example/android/rs/balls/balls.rs
+++ b/java/tests/Balls/src/com/example/android/rs/balls/balls.rs
@@ -46,8 +46,9 @@
     int2 gridDims = (int2){ rsAllocationGetDimX(gGrid),
                             rsAllocationGetDimY(gGrid) };
 
-    rs_allocation ain = rsGetAllocation(balls);
-    int32_t dimX = rsAllocationGetDimX(ain);
+    rs_allocation aNull;  // Empty rs_allocation, since we don't have an input.
+    rs_allocation aout = rsGetAllocation(balls);
+    int32_t dimX = rsAllocationGetDimX(aout);
 
     // Binning
     // Clear the particle list
@@ -92,7 +93,7 @@
     }
 
 
-    rsForEach(physics_script, ain, ain);
+    rsForEach(physics_script, aNull, aout);
 
     for (uint32_t ct=0; ct < dimX; ct++) {
         point[ct].position = balls[ct].position;
diff --git a/java/tests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/java/tests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
index 1a36417..77f554a 100644
--- a/java/tests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ b/java/tests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
@@ -112,7 +112,6 @@
      * Define enum type for test names
      */
     public enum TestName {
-        // totally there are 38 test cases
         LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed"),
         LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed"),
         LEVELS_VEC3_FULL ("Levels Vec3 Full"),
@@ -169,8 +168,6 @@
         }
     }
 
-    Bitmap mBitmapIn;
-    Bitmap mBitmapIn2;
     Bitmap mBitmapOut;
 
     private Spinner mSpinner;
@@ -423,7 +420,7 @@
             break;
         }
 
-        mTest.createBaseTest(this, mBitmapIn, mBitmapIn2, mBitmapOut);
+        mTest.createBaseTest(this);
         setupBars();
 
         mTest.runTest();
@@ -448,10 +445,15 @@
             };
 
     void init() {
-        mBitmapIn = loadBitmap(R.drawable.img1600x1067);
-        mBitmapIn2 = loadBitmap(R.drawable.img1600x1067b);
-        mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), mBitmapIn.getHeight(),
-                                         mBitmapIn.getConfig());
+        mRS = RenderScript.create(this);
+        mInPixelsAllocation = Allocation.createFromBitmapResource(
+                mRS, getResources(), R.drawable.img1600x1067);
+        mInPixelsAllocation2 = Allocation.createFromBitmapResource(
+                mRS, getResources(), R.drawable.img1600x1067b);
+        mBitmapOut = Bitmap.createBitmap(mInPixelsAllocation.getType().getX(),
+                                         mInPixelsAllocation.getType().getY(),
+                                         Bitmap.Config.ARGB_8888);
+        mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut);
 
         mDisplayView = (ImageView) findViewById(R.id.display);
         mDisplayView.setImageBitmap(mBitmapOut);
@@ -482,21 +484,6 @@
         mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText);
         mBenchmarkResult.setText("Result: not run");
 
-
-        mRS = RenderScript.create(this);
-        mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn,
-                                                          Allocation.MipmapControl.MIPMAP_NONE,
-                                                          Allocation.USAGE_SHARED |
-                                                          Allocation.USAGE_GRAPHICS_TEXTURE |
-                                                          Allocation.USAGE_SCRIPT);
-        mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, mBitmapIn2,
-                                                           Allocation.MipmapControl.MIPMAP_NONE,
-                                                           Allocation.USAGE_SHARED |
-                                                           Allocation.USAGE_GRAPHICS_TEXTURE |
-                                                           Allocation.USAGE_SCRIPT);
-        mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut);
-
-
         setupTests();
         changeTest(TestName.LEVELS_VEC3_RELAXED);
     }
@@ -518,8 +505,6 @@
         mInPixelsAllocation = null;
         mInPixelsAllocation2 = null;
         mOutPixelsAllocation = null;
-        mBitmapIn = null;
-        mBitmapIn2 = null;
         mBitmapOut = null;
     }
 
@@ -546,12 +531,6 @@
         init();
     }
 
-    private Bitmap loadBitmap(int resource) {
-        final BitmapFactory.Options options = new BitmapFactory.Options();
-        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
-        return BitmapFactory.decodeResource(getResources(), resource, options);
-    }
-
     // button hook
     public void benchmark(View v) {
         float t = getBenchmark();
diff --git a/java/tests/ImageProcessing/src/com/android/rs/image/TestBase.java b/java/tests/ImageProcessing/src/com/android/rs/image/TestBase.java
index a353d9c..cfa9897 100644
--- a/java/tests/ImageProcessing/src/com/android/rs/image/TestBase.java
+++ b/java/tests/ImageProcessing/src/com/android/rs/image/TestBase.java
@@ -19,9 +19,7 @@
 import android.app.Activity;
 import android.content.Context;
 import android.os.Bundle;
-import android.graphics.BitmapFactory;
 import android.graphics.Bitmap;
-import android.graphics.Canvas;
 import android.renderscript.ScriptC;
 import android.renderscript.RenderScript;
 import android.renderscript.Type;
@@ -104,7 +102,7 @@
         return false;
     }
 
-    public final void createBaseTest(ImageProcessingActivity ipact, Bitmap b, Bitmap b2, Bitmap outb) {
+    public final void createBaseTest(ImageProcessingActivity ipact) {
         act = ipact;
         mRS = ipact.mRS;
         mRS.setMessageHandler(new MessageProcessor(act));
diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/Blend.java b/java/tests/ImageProcessing_jb/src/com/android/rs/image/Blend.java
index 098830b..63c0c9c 100644
--- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/Blend.java
+++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/Blend.java
@@ -121,10 +121,10 @@
         image2.copy2DRangeFrom(0, 0, mInPixelsAllocation2.getType().getX(), mInPixelsAllocation2.getType().getY(), mInPixelsAllocation2, 0, 0);
 
         mBlendHelper.set_alpha(image1Alpha);
-        mBlendHelper.forEach_setImageAlpha(image1);
+        mBlendHelper.forEach_setImageAlpha(image1, image1);
 
         mBlendHelper.set_alpha(image2Alpha);
-        mBlendHelper.forEach_setImageAlpha(image2);
+        mBlendHelper.forEach_setImageAlpha(image2, image2);
 
         switch (currentIntrinsic) {
         case 0:
diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/blend.rs b/java/tests/ImageProcessing_jb/src/com/android/rs/image/blend.rs
index 63e7ea5..3f2fdc5 100644
--- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/blend.rs
+++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/blend.rs
@@ -17,8 +17,10 @@
 
 uchar alpha = 0x0;
 
-void setImageAlpha(uchar4 *v_out, uint32_t x, uint32_t y) {
-  v_out->rgba = convert_uchar4((convert_uint4(v_out->rgba) * alpha) >> (uint4)8);
-  v_out->a = alpha;
+uchar4 __attribute__((kernel)) setImageAlpha(uchar4 in, uint32_t x, uint32_t y) {
+    uchar4 out;
+    out.rgba = convert_uchar4((convert_uint4(in.rgba) * alpha) >> (uint4)8);
+    out.a = alpha;
+    return out;
 }
 
diff --git a/java/tests/LivePreview/src/com/android/rs/livepreview/RsYuv.java b/java/tests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
index 12d3185..15cd72a 100644
--- a/java/tests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
+++ b/java/tests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
@@ -27,6 +27,7 @@
 import android.renderscript.RenderScript;
 import android.util.Log;
 import android.view.TextureView;
+import android.view.Surface;
 import android.view.View;
 
 import android.content.res.Resources;
@@ -44,7 +45,7 @@
     private ScriptC_yuv mScript;
     private ScriptIntrinsicYuvToRGB mYuv;
     private boolean mHaveSurface;
-    private SurfaceTexture mSurface;
+    private Surface mSurface;
     private ScriptGroup mGroup;
 
     RsYuv(RenderScript rs) {
@@ -55,7 +56,7 @@
 
     void setupSurface() {
         if (mAllocationOut != null) {
-            mAllocationOut.setSurfaceTexture(mSurface);
+            mAllocationOut.setSurface(mSurface);
         }
         if (mSurface != null) {
             mHaveSurface = true;
@@ -116,7 +117,7 @@
 
             //mYuv.forEach(mAllocationOut);
             //mScript.forEach_root(mAllocationOut, mAllocationOut);
-            mAllocationOut.ioSendOutput();
+            mAllocationOut.ioSend();
         }
     }
 
@@ -125,21 +126,21 @@
     @Override
     public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
         android.util.Log.v("cpa", "onSurfaceTextureAvailable " + surface);
-        mSurface = surface;
+        mSurface = new Surface(surface);
         setupSurface();
     }
 
     @Override
     public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
         android.util.Log.v("cpa", "onSurfaceTextureSizeChanged " + surface);
-        mSurface = surface;
+        mSurface = new Surface(surface);
         setupSurface();
     }
 
     @Override
     public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
         android.util.Log.v("cpa", "onSurfaceTextureDestroyed " + surface);
-        mSurface = surface;
+        mSurface = null;
         setupSurface();
         return true;
     }
diff --git a/java/tests/SampleTest/src/com/android/rs/sample/SampleRSActivity.java b/java/tests/SampleTest/src/com/android/rs/sample/SampleRSActivity.java
index dd4a98a..feaa81d 100644
--- a/java/tests/SampleTest/src/com/android/rs/sample/SampleRSActivity.java
+++ b/java/tests/SampleTest/src/com/android/rs/sample/SampleRSActivity.java
@@ -157,7 +157,7 @@
         long t = java.lang.System.currentTimeMillis();
         mScript.invoke_setSampleData(alloc, mTwoByTwoAlloc, sampler);
         mScript.forEach_root(alloc);
-        alloc.ioSendOutput();
+        alloc.ioSend();
         mRS.finish();
         t = java.lang.System.currentTimeMillis() - t;
         Log.i(TAG, "Filter time is: " + t + " ms");
diff --git a/rs.h b/rs.h
index 566d9ea..e31762d 100644
--- a/rs.h
+++ b/rs.h
@@ -45,10 +45,10 @@
     // Allocation update
     const void* rsaAllocationGetType(RsContext con, RsAllocation va);
     // Type update
-    void rsaTypeGetNativeData(RsContext, RsType, uint32_t *typeData, uint32_t typeDataSize);
+    void rsaTypeGetNativeData(RsContext, RsType, uintptr_t *typeData, uint32_t typeDataSize);
     // Element update
-    void rsaElementGetNativeData(RsContext, RsElement, uint32_t *elemData, uint32_t elemDataSize);
-    void rsaElementGetSubElements(RsContext, RsElement, uint32_t *ids, const char **names,
+    void rsaElementGetNativeData(RsContext, RsElement, uintptr_t *elemData, uint32_t elemDataSize);
+    void rsaElementGetSubElements(RsContext, RsElement, uintptr_t *ids, const char **names,
                                   uint32_t *arraySizes, uint32_t dataSize);
 
     RsDevice rsDeviceCreate();
diff --git a/rs.spec b/rs.spec
index d765866..6ce258a 100644
--- a/rs.spec
+++ b/rs.spec
@@ -105,6 +105,7 @@
 
 ObjDestroy {
     param RsAsyncVoidPtr objPtr
+    handcodeApi
     }
 
 ElementCreate {
diff --git a/rsAllocation.cpp b/rsAllocation.cpp
index bb7fc17..d4cecd0 100644
--- a/rsAllocation.cpp
+++ b/rsAllocation.cpp
@@ -99,8 +99,10 @@
     const size_t eSize = mHal.state.type->getElementSizeBytes();
 
     if ((count * eSize) != sizeBytes) {
-        ALOGE("Allocation::subData called with mismatched size expected %zu, got %zu",
-             (count * eSize), sizeBytes);
+        char buf[1024];
+        sprintf(buf, "Allocation::subData called with mismatched size expected %zu, got %zu",
+                (count * eSize), sizeBytes);
+        rsc->setError(RS_ERROR_BAD_VALUE, buf);
         mHal.state.type->dumpLOGV("type info");
         return;
     }
@@ -127,8 +129,10 @@
     const size_t eSize = mHal.state.type->getElementSizeBytes();
 
     if ((count * eSize) != sizeBytes) {
-        ALOGE("Allocation::read called with mismatched size expected %zu, got %zu",
-             (count * eSize), sizeBytes);
+        char buf[1024];
+        sprintf(buf, "Allocation::read called with mismatched size expected %zu, got %zu",
+                (count * eSize), sizeBytes);
+        rsc->setError(RS_ERROR_BAD_VALUE, buf);
         mHal.state.type->dumpLOGV("type info");
         return;
     }
@@ -144,8 +148,9 @@
         stride = lineSize;
     } else {
         if ((lineSize * h) != sizeBytes) {
-            ALOGE("Allocation size mismatch, expected %zu, got %zu", (lineSize * h), sizeBytes);
-            rsAssert(!"Allocation::read called with mismatched size");
+            char buf[1024];
+            sprintf(buf, "Allocation size mismatch, expected %zu, got %zu", (lineSize * h), sizeBytes);
+            rsc->setError(RS_ERROR_BAD_VALUE, buf);
             return;
         }
     }
@@ -170,13 +175,11 @@
     size_t eSize = mHal.state.elementSizeBytes;
 
     if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
-        ALOGE("Error Allocation::subElementData component %i out of range.", cIdx);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
         return;
     }
 
     if (x >= mHal.drvState.lod[0].dimX) {
-        ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
@@ -184,7 +187,6 @@
     const Element * e = mHal.state.type->getElement()->getField(cIdx);
     uint32_t elemArraySize = mHal.state.type->getElement()->getFieldArraySize(cIdx);
     if (sizeBytes != e->getSizeBytes() * elemArraySize) {
-        ALOGE("Error Allocation::subElementData data size %zu does not match field size %zu.", sizeBytes, e->getSizeBytes());
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
         return;
     }
@@ -198,19 +200,16 @@
     size_t eSize = mHal.state.elementSizeBytes;
 
     if (x >= mHal.drvState.lod[0].dimX) {
-        ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
     if (y >= mHal.drvState.lod[0].dimY) {
-        ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
     if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
-        ALOGE("Error Allocation::subElementData component %i out of range.", cIdx);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
         return;
     }
@@ -218,7 +217,6 @@
     const Element * e = mHal.state.type->getElement()->getField(cIdx);
     uint32_t elemArraySize = mHal.state.type->getElement()->getFieldArraySize(cIdx);
     if (sizeBytes != e->getSizeBytes() * elemArraySize) {
-        ALOGE("Error Allocation::subElementData data size %zu does not match field size %zu.", sizeBytes, e->getSizeBytes());
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
         return;
     }
@@ -360,7 +358,8 @@
     // First make sure we are reading the correct object
     RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
     if (classID != RS_A3D_CLASS_ID_ALLOCATION) {
-        ALOGE("allocation loading skipped due to invalid class id\n");
+        rsc->setError(RS_ERROR_FATAL_DRIVER,
+                      "allocation loading failed due to corrupt file. (invalid id)\n");
         return NULL;
     }
 
@@ -381,7 +380,8 @@
     uint32_t packedSize = alloc->getPackedSize();
     if (dataSize != type->getPackedSizeBytes() &&
         dataSize != packedSize) {
-        ALOGE("failed to read allocation because numbytes written is not the same loaded type wants\n");
+        rsc->setError(RS_ERROR_FATAL_DRIVER,
+                      "allocation loading failed due to corrupt file. (invalid size)\n");
         ObjectBase::checkDelete(alloc);
         ObjectBase::checkDelete(type);
         return NULL;
@@ -455,7 +455,7 @@
 }
 
 void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
-    ALOGE("not implemented");
+    rsc->setError(RS_ERROR_FATAL_DRIVER, "resize2d not implemented");
 }
 
 #ifndef RS_COMPATIBILITY_LIB
diff --git a/rsContext.cpp b/rsContext.cpp
index 01debb2..0ef524c 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -19,6 +19,8 @@
 #include "rsContext.h"
 #include "rsThreadIO.h"
 
+#include "rsgApiStructs.h"
+
 #ifndef RS_COMPATIBILITY_LIB
 #include "rsMesh.h"
 #include <ui/FramebufferNativeWindow.h>
@@ -319,14 +321,14 @@
 #define OVERRIDE_RS_DRIVER_STRING STR(OVERRIDE_RS_DRIVER)
 
     if (getProp("debug.rs.default-CPU-driver") != 0) {
-        ALOGE("Skipping override driver and loading default CPU driver");
+        ALOGD("Skipping override driver and loading default CPU driver");
     } else if (rsc->mForceCpu) {
         ALOGV("Application requested CPU execution");
     } else if (rsc->getContextType() == RS_CONTEXT_TYPE_DEBUG) {
         ALOGV("Application requested debug context");
     } else {
         if (loadRuntime(OVERRIDE_RS_DRIVER_STRING, rsc)) {
-            ALOGE("Successfully loaded runtime: %s", OVERRIDE_RS_DRIVER_STRING);
+            ALOGV("Successfully loaded runtime: %s", OVERRIDE_RS_DRIVER_STRING);
             loadDefault = false;
         } else {
             ALOGE("Failed to load runtime %s, loading default", OVERRIDE_RS_DRIVER_STRING);
@@ -910,6 +912,32 @@
     rsc->sendMessageToClient(data, RS_MESSAGE_TO_CLIENT_USER, id, len, true);
 }
 
+// implementation of handcode LF_ObjDestroy
+// required so nObjDestroy can be run from finalizer without blocking
+void LF_ObjDestroy_handcode(const Context *rsc, RsAsyncVoidPtr objPtr) {
+    if (((Context *)rsc)->isSynchronous()) {
+        rsi_ObjDestroy((Context *)rsc, objPtr);
+        return;
+    }
+
+    // struct has two parts:
+    // RsPlaybackRemoteHeader (cmdID and bytes)
+    // RS_CMD_ObjDestroy (ptr)
+    struct destroyCmd {
+        uint32_t cmdID;
+        uint32_t bytes;
+        RsAsyncVoidPtr ptr;
+     };
+
+    destroyCmd cmd;
+    cmd.cmdID = RS_CMD_ID_ObjDestroy;
+    cmd.bytes = sizeof(RsAsyncVoidPtr);
+    cmd.ptr = objPtr;
+    ThreadIO *io = &((Context *)rsc)->mIO;
+    io->coreWrite((void*)&cmd, sizeof(destroyCmd));
+
+}
+
 }
 }
 
@@ -946,3 +974,4 @@
     ObjectBase *ob = static_cast<ObjectBase *>(obj);
     (*name) = ob->getName();
 }
+
diff --git a/rsContext.h b/rsContext.h
index ab56c27..d21227e 100644
--- a/rsContext.h
+++ b/rsContext.h
@@ -312,6 +312,8 @@
     uint32_t mAverageFPS;
 };
 
+void LF_ObjDestroy_handcode(const Context *rsc, RsAsyncVoidPtr objPtr);
+
 } // renderscript
 } // android
 #endif
diff --git a/rsg_generator.c b/rsg_generator.c
index fd531b6..bbaaeb4 100644
--- a/rsg_generator.c
+++ b/rsg_generator.c
@@ -226,6 +226,21 @@
                 fprintf(f, "%s", vt->name);
             }
             fprintf(f, ");\n");
+        } else if (api->handcodeApi) {
+            // handle handcode path
+            fprintf(f, "    LF_%s_handcode(", api->name);
+            if (!api->nocontext) {
+                fprintf(f, "(Context *)rsc");
+            }
+            for (ct2=0; ct2 < api->paramCount; ct2++) {
+                const VarType *vt = &api->params[ct2];
+                if (ct2 > 0 || !api->nocontext) {
+                    fprintf(f, ", ");
+                }
+                fprintf(f, "%s", vt->name);
+            }
+            fprintf(f, ");\n");
+
         } else {
             // handle synchronous path
             fprintf(f, "    if (((Context *)rsc)->isSynchronous()) {\n");
diff --git a/scriptc/rs_cl.rsh b/scriptc/rs_cl.rsh
deleted file mode 100644
index 7ba2cb6..0000000
--- a/scriptc/rs_cl.rsh
+++ /dev/null
@@ -1,1122 +0,0 @@
-/*
- * Copyright (C) 2011-2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** @file rs_cl.rsh
- *  \brief Basic math functions
- *
- *
- */
-
-#ifndef __RS_CL_RSH__
-#define __RS_CL_RSH__
-
-// Conversions
-#define CVT_FUNC_2(typeout, typein)                             \
-_RS_RUNTIME typeout##2 __attribute__((const, overloadable))     \
-        convert_##typeout##2(typein##2 v);                      \
-_RS_RUNTIME typeout##3 __attribute__((const, overloadable))     \
-        convert_##typeout##3(typein##3 v);                      \
-_RS_RUNTIME typeout##4 __attribute__((const, overloadable))     \
-        convert_##typeout##4(typein##4 v);
-
-
-#define CVT_FUNC(type)  CVT_FUNC_2(type, uchar)     \
-                        CVT_FUNC_2(type, char)      \
-                        CVT_FUNC_2(type, ushort)    \
-                        CVT_FUNC_2(type, short)     \
-                        CVT_FUNC_2(type, uint)      \
-                        CVT_FUNC_2(type, int)       \
-                        CVT_FUNC_2(type, float)
-
-/**
- * Convert to char.
- *
- * Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-CVT_FUNC(char)
-
-/**
- * Convert to unsigned char.
- *
- * Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-CVT_FUNC(uchar)
-
-/**
- * Convert to short.
- *
- * Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-CVT_FUNC(short)
-
-/**
- * Convert to unsigned short.
- *
- * Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-CVT_FUNC(ushort)
-
-/**
- * Convert to int.
- *
- * Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-CVT_FUNC(int)
-
-/**
- * Convert to unsigned int.
- *
- * Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-CVT_FUNC(uint)
-
-/**
- * Convert to float.
- *
- * Supports 2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-CVT_FUNC(float)
-
-// Float ops, 6.11.2
-
-#ifdef DOXYGEN
-
-#define FN_FUNC_FN(fnc)
-#define F_FUNC_FN(fnc)
-#define IN_FUNC_FN(fnc)
-#define FN_FUNC_FN_FN(fnc)
-#define F_FUNC_FN_FN(fnc)
-#define FN_FUNC_FN_F(fnc)
-#define FN_FUNC_FN_IN(fnc)
-#define FN_FUNC_FN_I(fnc)
-#define FN_FUNC_FN_PFN(fnc)
-#define FN_FUNC_FN_PIN(fnc)
-#define FN_FUNC_FN_FN_FN(fnc)
-#define FN_FUNC_FN_FN_F(fnc)
-#define FN_FUNC_FN_F_F(fnc)
-#define FN_FUNC_FN_FN_PIN(fnc)
-
-#else
-
-#define FN_FUNC_FN(fnc)                                                \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) fnc(float2 v); \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) fnc(float3 v); \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) fnc(float4 v);
-
-#define F_FUNC_FN(fnc)                                                \
-_RS_RUNTIME float __attribute__((const, overloadable)) fnc(float2 v); \
-_RS_RUNTIME float __attribute__((const, overloadable)) fnc(float3 v); \
-_RS_RUNTIME float __attribute__((const, overloadable)) fnc(float4 v);
-
-#define IN_FUNC_FN(fnc)                                              \
-_RS_RUNTIME int2 __attribute__((const, overloadable)) fnc(float2 v); \
-_RS_RUNTIME int3 __attribute__((const, overloadable)) fnc(float3 v); \
-_RS_RUNTIME int4 __attribute__((const, overloadable)) fnc(float4 v);
-
-#define FN_FUNC_FN_FN(fnc)                                                         \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) fnc(float2 v1, float2 v2); \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) fnc(float3 v1, float3 v2); \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) fnc(float4 v1, float4 v2);
-
-#define F_FUNC_FN_FN(fnc)                                                         \
-_RS_RUNTIME float __attribute__((const, overloadable)) fnc(float2 v1, float2 v2); \
-_RS_RUNTIME float __attribute__((const, overloadable)) fnc(float3 v1, float3 v2); \
-_RS_RUNTIME float __attribute__((const, overloadable)) fnc(float4 v1, float4 v2);
-
-#define FN_FUNC_FN_F(fnc)                                                         \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) fnc(float2 v1, float v2); \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) fnc(float3 v1, float v2); \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) fnc(float4 v1, float v2);
-
-#define FN_FUNC_FN_IN(fnc)                                                       \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) fnc(float2 v1, int2 v2); \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) fnc(float3 v1, int3 v2); \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) fnc(float4 v1, int4 v2);
-
-#define FN_FUNC_FN_I(fnc)                                                       \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) fnc(float2 v1, int v2); \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) fnc(float3 v1, int v2); \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) fnc(float4 v1, int v2);
-
-#define FN_FUNC_FN_PFN(fnc)                            \
-_RS_RUNTIME float2 __attribute__((pure, overloadable)) \
-        fnc(float2 v1, float2 *v2);                    \
-_RS_RUNTIME float3 __attribute__((pure, overloadable)) \
-        fnc(float3 v1, float3 *v2);                    \
-_RS_RUNTIME float4 __attribute__((pure, overloadable)) \
-        fnc(float4 v1, float4 *v2);
-
-#define FN_FUNC_FN_PIN(fnc)                                                      \
-_RS_RUNTIME float2 __attribute__((pure, overloadable)) fnc(float2 v1, int2 *v2); \
-_RS_RUNTIME float3 __attribute__((pure, overloadable)) fnc(float3 v1, int3 *v2); \
-_RS_RUNTIME float4 __attribute__((pure, overloadable)) fnc(float4 v1, int4 *v2);
-
-#define FN_FUNC_FN_FN_FN(fnc)                           \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) \
-        fnc(float2 v1, float2 v2, float2 v3);           \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) \
-        fnc(float3 v1, float3 v2, float3 v3);           \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) \
-        fnc(float4 v1, float4 v2, float4 v3);
-
-#define FN_FUNC_FN_FN_F(fnc)                            \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) \
-        fnc(float2 v1, float2 v2, float v3);            \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) \
-        fnc(float3 v1, float3 v2, float v3);            \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) \
-        fnc(float4 v1, float4 v2, float v3);
-
-#define FN_FUNC_FN_F_F(fnc)                             \
-_RS_RUNTIME float2 __attribute__((const, overloadable)) \
-        fnc(float2 v1, float v2, float v3);             \
-_RS_RUNTIME float3 __attribute__((const, overloadable)) \
-        fnc(float3 v1, float v2, float v3);             \
-_RS_RUNTIME float4 __attribute__((const, overloadable)) \
-        fnc(float4 v1, float v2, float v3);
-
-#define FN_FUNC_FN_FN_PIN(fnc)                         \
-_RS_RUNTIME float2 __attribute__((pure, overloadable)) \
-        fnc(float2 v1, float2 v2, int2 *v3);           \
-_RS_RUNTIME float3 __attribute__((pure, overloadable)) \
-        fnc(float3 v1, float3 v2, int3 *v3);           \
-_RS_RUNTIME float4 __attribute__((pure, overloadable)) \
-        fnc(float4 v1, float4 v2, int4 *v3);
-
-#endif  // DOXYGEN
-
-
-/**
- * Return the inverse cosine.
- *
- * Supports float, float2, float3, float4
- */
-extern float __attribute__((const, overloadable)) acos(float);
-FN_FUNC_FN(acos)
-
-/**
- * Return the inverse hyperbolic cosine.
- *
- * Supports float, float2, float3, float4
- */
-extern float __attribute__((const, overloadable)) acosh(float);
-FN_FUNC_FN(acosh)
-
-/**
- * Return the inverse cosine divided by PI.
- *
- * Supports float, float2, float3, float4
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) acospi(float v);
-FN_FUNC_FN(acospi)
-
-/**
- * Return the inverse sine.
- *
- * Supports float, float2, float3, float4
- */
-extern float __attribute__((const, overloadable)) asin(float);
-FN_FUNC_FN(asin)
-
-/**
- * Return the inverse hyperbolic sine.
- *
- * Supports float, float2, float3, float4
- */
-extern float __attribute__((const, overloadable)) asinh(float);
-FN_FUNC_FN(asinh)
-
-
-/**
- * Return the inverse sine divided by PI.
- *
- * Supports float, float2, float3, float4
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) asinpi(float v);
-FN_FUNC_FN(asinpi)
-
-/**
- * Return the inverse tangent.
- *
- * Supports float, float2, float3, float4
- */
-extern float __attribute__((const, overloadable)) atan(float);
-FN_FUNC_FN(atan)
-
-/**
- * Return the inverse tangent of y / x.
- *
- * Supports float, float2, float3, float4.  Both arguments must be of the same
- * type.
- *
- * @param y
- * @param x
- */
-extern float __attribute__((const, overloadable)) atan2(float y, float x);
-FN_FUNC_FN_FN(atan2)
-
-/**
- * Return the inverse hyperbolic tangent.
- *
- * Supports float, float2, float3, float4
- */
-extern float __attribute__((const, overloadable)) atanh(float);
-FN_FUNC_FN(atanh)
-
-/**
- * Return the inverse tangent divided by PI.
- *
- * Supports float, float2, float3, float4
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) atanpi(float v);
-FN_FUNC_FN(atanpi)
-
-/**
- * Return the inverse tangent of y / x, divided by PI.
- *
- * Supports float, float2, float3, float4.  Both arguments must be of the same
- * type.
- *
- * @param y
- * @param x
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) atan2pi(float y, float x);
-FN_FUNC_FN_FN(atan2pi)
-
-
-/**
- * Return the cube root.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) cbrt(float);
-FN_FUNC_FN(cbrt)
-
-/**
- * Return the smallest integer not less than a value.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) ceil(float);
-FN_FUNC_FN(ceil)
-
-/**
- * Copy the sign bit from y to x.
- *
- * Supports float, float2, float3, float4.  Both arguments must be of the same
- * type.
- *
- * @param x
- * @param y
- */
-extern float __attribute__((const, overloadable)) copysign(float x, float y);
-FN_FUNC_FN_FN(copysign)
-
-/**
- * Return the cosine.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) cos(float);
-FN_FUNC_FN(cos)
-
-/**
- * Return the hypebolic cosine.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) cosh(float);
-FN_FUNC_FN(cosh)
-
-/**
- * Return the cosine of the value * PI.
- *
- * Supports float, float2, float3, float4.
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) cospi(float v);
-FN_FUNC_FN(cospi)
-
-/**
- * Return the complementary error function.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) erfc(float);
-FN_FUNC_FN(erfc)
-
-/**
- * Return the error function.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) erf(float);
-FN_FUNC_FN(erf)
-
-/**
- * Return e ^ value.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) exp(float);
-FN_FUNC_FN(exp)
-
-/**
- * Return 2 ^ value.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) exp2(float);
-FN_FUNC_FN(exp2)
-
-/**
- * Return x ^ y.
- *
- * Supports float, float2, float3, float4. Both arguments must be of the same
- * type.
- */
-extern float __attribute__((const, overloadable)) pow(float x, float y);
-FN_FUNC_FN_FN(pow)
-
-/**
- * Return 10 ^ value.
- *
- * Supports float, float2, float3, float4.
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) exp10(float v);
-FN_FUNC_FN(exp10)
-
-/**
- * Return (e ^ value) - 1.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) expm1(float);
-FN_FUNC_FN(expm1)
-
-/**
- * Return the absolute value of a value.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) fabs(float);
-FN_FUNC_FN(fabs)
-
-/**
- * Return the positive difference between two values.
- *
- * Supports float, float2, float3, float4.  Both arguments must be of the same
- * type.
- */
-extern float __attribute__((const, overloadable)) fdim(float, float);
-FN_FUNC_FN_FN(fdim)
-
-/**
- * Return the smallest integer not greater than a value.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) floor(float);
-FN_FUNC_FN(floor)
-
-/**
- * Return a*b + c.
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) fma(float a, float b, float c);
-FN_FUNC_FN_FN_FN(fma)
-
-/**
- * Return (x < y ? y : x)
- *
- * Supports float, float2, float3, float4.
- * @param x: may be float, float2, float3, float4
- * @param y: may be float or vector.  If vector must match type of x.
- */
-extern float __attribute__((const, overloadable)) fmax(float x, float y);
-FN_FUNC_FN_FN(fmax);
-FN_FUNC_FN_F(fmax);
-
-/**
- * Return (x > y ? y : x)
- *
- * @param x: may be float, float2, float3, float4
- * @param y: may be float or vector.  If vector must match type of x.
- */
-extern float __attribute__((const, overloadable)) fmin(float x, float y);
-FN_FUNC_FN_FN(fmin);
-FN_FUNC_FN_F(fmin);
-
-/**
- * Return the remainder from x / y
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) fmod(float x, float y);
-FN_FUNC_FN_FN(fmod)
-
-/**
- * Return fractional part of v
- *
- * @param iptr  iptr[0] will be set to the floor of the input value.
- * Supports float, float2, float3, float4.
- */
-_RS_RUNTIME float __attribute__((pure, overloadable)) fract(float v, float *iptr);
-FN_FUNC_FN_PFN(fract)
-
-/**
- * Return fractional part of v
- *
- * Supports float, float2, float3, float4.
- */
-static inline float __attribute__((const, overloadable)) fract(float v) {
-    float unused;
-    return fract(v, &unused);
-}
-
-static inline float2 __attribute__((const, overloadable)) fract(float2 v) {
-    float2 unused;
-    return fract(v, &unused);
-}
-
-static inline float3 __attribute__((const, overloadable)) fract(float3 v) {
-    float3 unused;
-    return fract(v, &unused);
-}
-
-static inline float4 __attribute__((const, overloadable)) fract(float4 v) {
-    float4 unused;
-    return fract(v, &unused);
-}
-
-/**
- * Return the mantissa and place the exponent into iptr[0]
- *
- * @param v Supports float, float2, float3, float4.
- * @param iptr  Must have the same vector size as v.
- */
-extern float __attribute__((pure, overloadable)) frexp(float v, int *iptr);
-FN_FUNC_FN_PIN(frexp)
-
-/**
- * Return sqrt(x*x + y*y)
- *
- * Supports float, float2, float3, float4.
- */
-extern float __attribute__((const, overloadable)) hypot(float x, float y);
-FN_FUNC_FN_FN(hypot)
-
-/**
- * Return the integer exponent of a value
- *
- * Supports 1,2,3,4 components
- */
-extern int __attribute__((const, overloadable)) ilogb(float);
-IN_FUNC_FN(ilogb)
-
-/**
- * Return (x * 2^y)
- *
- * @param x Supports 1,2,3,4 components
- * @param y Supports single component or matching vector.
- */
-extern float __attribute__((const, overloadable)) ldexp(float x, int y);
-FN_FUNC_FN_IN(ldexp)
-FN_FUNC_FN_I(ldexp)
-
-/**
- * Return the log gamma
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) lgamma(float);
-FN_FUNC_FN(lgamma)
-
-/**
- * Return the log gamma and sign
- *
- * @param x Supports 1,2,3,4 components
- * @param y Supports matching vector.
- */
-extern float __attribute__((pure, overloadable)) lgamma(float x, int* y);
-FN_FUNC_FN_PIN(lgamma)
-
-/**
- * Return the natural logarithm
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) log(float);
-FN_FUNC_FN(log)
-
-/**
- * Return the base 10 logarithm
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) log10(float);
-FN_FUNC_FN(log10)
-
-/**
- * Return the base 2 logarithm
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) log2(float v);
-FN_FUNC_FN(log2)
-
-/**
- * Return the natural logarithm of (v + 1.0f)
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) log1p(float v);
-FN_FUNC_FN(log1p)
-
-/**
- * Compute the exponent of the value.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) logb(float);
-FN_FUNC_FN(logb)
-
-/**
- * Compute (a * b) + c
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) mad(float a, float b, float c);
-FN_FUNC_FN_FN_FN(mad)
-
-/**
- * Return the integral and fractional components of a number.
- * Supports 1,2,3,4 components
- *
- * @param x Source value
- * @param iret iret[0] will be set to the integral portion of the number.
- * @return The floating point portion of the value.
- */
-extern float __attribute__((pure, overloadable)) modf(float x, float *iret);
-FN_FUNC_FN_PFN(modf);
-
-extern float __attribute__((const, overloadable)) nan(uint);
-
-/**
- * Return the next floating point number from x towards y.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) nextafter(float x, float y);
-FN_FUNC_FN_FN(nextafter)
-
-/**
- * Return (v ^ p).
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) pown(float v, int p);
-FN_FUNC_FN_IN(pown)
-
-/**
- * Return (v ^ p).
- * @param v must be greater than 0.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) powr(float v, float p);
-FN_FUNC_FN_FN(powr)
-
-/**
- * Return round x/y to the nearest integer then compute the remander.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) remainder(float x, float y);
-FN_FUNC_FN_FN(remainder)
-
-// document once we know the precision of bionic
-extern float __attribute__((pure, overloadable)) remquo(float, float, int *);
-FN_FUNC_FN_FN_PIN(remquo)
-
-/**
- * Round to the nearest integral value.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) rint(float);
-FN_FUNC_FN(rint)
-
-/**
- * Compute the Nth root of a value.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) rootn(float v, int n);
-FN_FUNC_FN_IN(rootn)
-
-/**
- * Round to the nearest integral value.  Half values are rounded away from zero.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) round(float);
-FN_FUNC_FN(round)
-
-/**
- * Return the square root of a value.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) sqrt(float);
-FN_FUNC_FN(sqrt)
-
-/**
- * Return (1 / sqrt(value)).
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) rsqrt(float v);
-FN_FUNC_FN(rsqrt)
-
-/**
- * Return the sine of a value specified in radians.
- *
- * @param v The incoming value in radians
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) sin(float v);
-FN_FUNC_FN(sin)
-
-/**
- * Return the sine and cosine of a value.
- *
- * @return sine
- * @param v The incoming value in radians
- * @param *cosptr cosptr[0] will be set to the cosine value.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((pure, overloadable)) sincos(float v, float *cosptr);
-FN_FUNC_FN_PFN(sincos);
-
-/**
- * Return the hyperbolic sine of a value specified in radians.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) sinh(float);
-FN_FUNC_FN(sinh)
-
-/**
- * Return the sin(v * PI).
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) sinpi(float v);
-FN_FUNC_FN(sinpi)
-
-/**
- * Return the tangent of a value.
- *
- * Supports 1,2,3,4 components
- * @param v The incoming value in radians
- */
-extern float __attribute__((const, overloadable)) tan(float v);
-FN_FUNC_FN(tan)
-
-/**
- * Return the hyperbolic tangent of a value.
- *
- * Supports 1,2,3,4 components
- * @param v The incoming value in radians
- */
-extern float __attribute__((const, overloadable)) tanh(float);
-FN_FUNC_FN(tanh)
-
-/**
- * Return tan(v * PI)
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) tanpi(float v);
-FN_FUNC_FN(tanpi)
-
-/**
- * Compute the gamma function of a value.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) tgamma(float);
-FN_FUNC_FN(tgamma)
-
-/**
- * Round to integral using truncation.
- *
- * Supports 1,2,3,4 components
- */
-extern float __attribute__((const, overloadable)) trunc(float);
-FN_FUNC_FN(trunc)
-
-#ifdef DOXYGEN
-
-#define XN_FUNC_YN(typeout, fnc, typein)                                \
-extern typeout __attribute__((overloadable)) fnc(typein v);
-
-#define XN_FUNC_XN_XN_BODY(type, fnc, body)         \
-_RS_RUNTIME type __attribute__((overloadable))      \
-        fnc(type v1, type v2);
-
-#else
-
-#define XN_FUNC_YN(typeout, fnc, typein)                                      \
-extern typeout __attribute__((const, overloadable)) fnc(typein v);            \
-_RS_RUNTIME typeout##2 __attribute__((const, overloadable)) fnc(typein##2 v); \
-_RS_RUNTIME typeout##3 __attribute__((const, overloadable)) fnc(typein##3 v); \
-_RS_RUNTIME typeout##4 __attribute__((const, overloadable)) fnc(typein##4 v);
-
-#define XN_FUNC_XN_XN_BODY(type, fnc, body)              \
-_RS_RUNTIME type __attribute__((const, overloadable))    \
-        fnc(type v1, type v2);                           \
-_RS_RUNTIME type##2 __attribute__((const, overloadable)) \
-        fnc(type##2 v1, type##2 v2);                     \
-_RS_RUNTIME type##3 __attribute__((const, overloadable)) \
-        fnc(type##3 v1, type##3 v2);                     \
-_RS_RUNTIME type##4 __attribute__((const, overloadable)) \
-        fnc(type##4 v1, type##4 v2);
-
-#endif  // DOXYGEN
-
-#define UIN_FUNC_IN(fnc)          \
-XN_FUNC_YN(uchar, fnc, char)      \
-XN_FUNC_YN(ushort, fnc, short)    \
-XN_FUNC_YN(uint, fnc, int)
-
-#define IN_FUNC_IN(fnc)           \
-XN_FUNC_YN(uchar, fnc, uchar)     \
-XN_FUNC_YN(char, fnc, char)       \
-XN_FUNC_YN(ushort, fnc, ushort)   \
-XN_FUNC_YN(short, fnc, short)     \
-XN_FUNC_YN(uint, fnc, uint)       \
-XN_FUNC_YN(int, fnc, int)
-
-#define IN_FUNC_IN_IN_BODY(fnc, body)   \
-XN_FUNC_XN_XN_BODY(uchar, fnc, body)    \
-XN_FUNC_XN_XN_BODY(char, fnc, body)     \
-XN_FUNC_XN_XN_BODY(ushort, fnc, body)   \
-XN_FUNC_XN_XN_BODY(short, fnc, body)    \
-XN_FUNC_XN_XN_BODY(uint, fnc, body)     \
-XN_FUNC_XN_XN_BODY(int, fnc, body)      \
-XN_FUNC_XN_XN_BODY(float, fnc, body)
-
-/**
- * \fn uchar abs(char)
- * Return the absolute value of a value.
- *
- * Supports 1,2,3,4 components of char, short, int.
- */
-UIN_FUNC_IN(abs)
-
-/**
- * Return the number of leading 0-bits in a value.
- *
- * Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int.
- */
-IN_FUNC_IN(clz)
-
-/**
- * Return the minimum of two values.
- *
- * Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-IN_FUNC_IN_IN_BODY(min, (v1 < v2 ? v1 : v2))
-FN_FUNC_FN_F(min)
-
-/**
- * Return the maximum of two values.
- *
- * Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float.
- */
-IN_FUNC_IN_IN_BODY(max, (v1 > v2 ? v1 : v2))
-FN_FUNC_FN_F(max)
-
-/**
- *  Clamp a value to a specified high and low bound.
- *
- * @param amount value to be clamped.  Supports 1,2,3,4 components
- * @param low Lower bound, must be scalar or matching vector.
- * @param high High bound, must match type of low
- */
-
-#if !defined(RS_VERSION) || (RS_VERSION < 19)
-_RS_RUNTIME float __attribute__((const, overloadable)) clamp(float amount, float low, float high);
-FN_FUNC_FN_FN_FN(clamp)
-FN_FUNC_FN_F_F(clamp)
-#else
-#define _CLAMP(T)                                                                   \
-extern T __attribute__((overloadable)) clamp(T amount, T low, T high);              \
-extern T##2 __attribute__((overloadable)) clamp(T##2 amount, T##2 low, T##2 high);  \
-extern T##3 __attribute__((overloadable)) clamp(T##3 amount, T##3 low, T##3 high);  \
-extern T##4 __attribute__((overloadable)) clamp(T##4 amount, T##4 low, T##4 high);  \
-extern T##2 __attribute__((overloadable)) clamp(T##2 amount, T low, T high);        \
-extern T##3 __attribute__((overloadable)) clamp(T##3 amount, T low, T high);        \
-extern T##4 __attribute__((overloadable)) clamp(T##4 amount, T low, T high)
-
-_CLAMP(float);
-_CLAMP(double);
-_CLAMP(char);
-_CLAMP(uchar);
-_CLAMP(short);
-_CLAMP(ushort);
-_CLAMP(int);
-_CLAMP(uint);
-_CLAMP(long);
-_CLAMP(ulong);
-
-#undef _CLAMP
-#endif
-
-/**
- * Convert from radians to degrees.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) degrees(float radians);
-FN_FUNC_FN(degrees)
-
-/**
- * return start + ((stop - start) * amount);
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) mix(float start, float stop, float amount);
-FN_FUNC_FN_FN_FN(mix)
-FN_FUNC_FN_FN_F(mix)
-
-/**
- * Convert from degrees to radians.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) radians(float degrees);
-FN_FUNC_FN(radians)
-
-/**
- * if (v < edge)
- *     return 0.f;
- * else
- *     return 1.f;
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) step(float edge, float v);
-FN_FUNC_FN_FN(step)
-FN_FUNC_FN_F(step)
-
-// FIXME: not implemented
-#if 0
-extern float __attribute__((const, overloadable)) smoothstep(float, float, float);
-extern float2 __attribute__((const, overloadable)) smoothstep(float2, float2, float2);
-extern float3 __attribute__((const, overloadable)) smoothstep(float3, float3, float3);
-extern float4 __attribute__((const, overloadable)) smoothstep(float4, float4, float4);
-extern float2 __attribute__((const, overloadable)) smoothstep(float, float, float2);
-extern float3 __attribute__((const, overloadable)) smoothstep(float, float, float3);
-extern float4 __attribute__((const, overloadable)) smoothstep(float, float, float4);
-#endif
-
-/**
- * Return the sign of a value.
- *
- * if (v < 0) return -1.f;
- * else if (v > 0) return 1.f;
- * else return 0.f;
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) sign(float v);
-FN_FUNC_FN(sign)
-
-/**
- * Compute the cross product of two vectors.
- *
- * Supports 3,4 components
- */
-_RS_RUNTIME float3 __attribute__((const, overloadable)) cross(float3 lhs, float3 rhs);
-_RS_RUNTIME float4 __attribute__((const, overloadable)) cross(float4 lhs, float4 rhs);
-
-/**
- * Compute the dot product of two vectors.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) dot(float lhs, float rhs);
-F_FUNC_FN_FN(dot)
-
-/**
- * Compute the length of a vector.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) length(float v);
-F_FUNC_FN(length)
-
-/**
- * Compute the distance between two points.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) distance(float lhs, float rhs);
-F_FUNC_FN_FN(distance)
-
-/**
- * Normalize a vector.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) normalize(float v);
-FN_FUNC_FN(normalize)
-
-
-// New approx API functions
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-
-/**
- * Return the approximate reciprocal of a value.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) half_recip(float);
-FN_FUNC_FN(half_recip)
-
-/**
- * Return the approximate square root of a value.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) half_sqrt(float);
-FN_FUNC_FN(half_sqrt)
-
-/**
- * Return the approximate value of (1 / sqrt(value)).
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) half_rsqrt(float v);
-FN_FUNC_FN(half_rsqrt)
-
-/**
- * Compute the approximate length of a vector.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) fast_length(float v);
-F_FUNC_FN(fast_length)
-
-/**
- * Compute the approximate distance between two points.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) fast_distance(float lhs, float rhs);
-F_FUNC_FN_FN(fast_distance)
-
-/**
- * Approximately normalize a vector.
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) fast_normalize(float v);
-F_FUNC_FN(fast_normalize)
-
-#endif  // (defined(RS_VERSION) && (RS_VERSION >= 17))
-
-
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-// Fast native math functions.
-
-
-/**
- * Fast approximate exp2
- * valid for inputs -125.f to 125.f
- * Max 8192 ulps of error
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) native_exp2(float v);
-FN_FUNC_FN(native_exp2)
-
-/**
- * Fast approximate exp
- * valid for inputs -86.f to 86.f
- * Max 8192 ulps of error
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) native_exp(float v);
-FN_FUNC_FN(native_exp)
-
-/**
- * Fast approximate exp10
- * valid for inputs -37.f to 37.f
- * Max 8192 ulps of error
- *
- * Supports 1,2,3,4 components
- */
-_RS_RUNTIME float __attribute__((const, overloadable)) native_exp10(float v);
-FN_FUNC_FN(native_exp10)
-
-
-_RS_RUNTIME float __attribute__((const, overloadable)) native_log2(float v);
-FN_FUNC_FN(native_log2)
-
-_RS_RUNTIME float __attribute__((const, overloadable)) native_log(float v);
-FN_FUNC_FN(native_log)
-
-_RS_RUNTIME float __attribute__((const, overloadable)) native_log10(float v);
-FN_FUNC_FN(native_log10)
-
-
-_RS_RUNTIME float __attribute__((const, overloadable)) native_powr(float v, float y);
-FN_FUNC_FN_FN(native_powr)
-
-
-#endif  // (defined(RS_VERSION) && (RS_VERSION >= 18))
-
-
-#undef CVT_FUNC
-#undef CVT_FUNC_2
-#undef FN_FUNC_FN
-#undef F_FUNC_FN
-#undef IN_FUNC_FN
-#undef FN_FUNC_FN_FN
-#undef F_FUNC_FN_FN
-#undef FN_FUNC_FN_F
-#undef FN_FUNC_FN_IN
-#undef FN_FUNC_FN_I
-#undef FN_FUNC_FN_PFN
-#undef FN_FUNC_FN_PIN
-#undef FN_FUNC_FN_FN_FN
-#undef FN_FUNC_FN_FN_F
-#undef FN_FUNC_FN_F_F
-#undef FN_FUNC_FN_FN_PIN
-#undef XN_FUNC_YN
-#undef UIN_FUNC_IN
-#undef IN_FUNC_IN
-#undef XN_FUNC_XN_XN_BODY
-#undef IN_FUNC_IN_IN_BODY
-
-#endif
diff --git a/scriptc/rs_core.rsh b/scriptc/rs_core.rsh
index 9caf355..0d3642e 100644
--- a/scriptc/rs_core.rsh
+++ b/scriptc/rs_core.rsh
@@ -51,7 +51,7 @@
 #include "rs_types.rsh"
 #include "rs_allocation.rsh"
 #include "rs_atomic.rsh"
-#include "rs_cl.rsh"
+#include "rs_core_math.rsh"
 #include "rs_debug.rsh"
 #include "rs_element.rsh"
 #include "rs_math.rsh"
diff --git a/scriptc/rs_core_math.rsh b/scriptc/rs_core_math.rsh
new file mode 100644
index 0000000..3984c6d
--- /dev/null
+++ b/scriptc/rs_core_math.rsh
@@ -0,0 +1,8838 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __rs_core_math_rsh__
+#define __rs_core_math_rsh__
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to float2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))convert_float2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to float3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))convert_float3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to float4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))convert_float4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to double2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double2 __attribute__((const, overloadable))convert_double2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to double3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double3 __attribute__((const, overloadable))convert_double3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to double4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern double4 __attribute__((const, overloadable))convert_double4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to char2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))convert_char2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to char3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))convert_char3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to char4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))convert_char4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to uchar2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))convert_uchar2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to uchar3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))convert_uchar3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to uchar4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))convert_uchar4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to short2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))convert_short2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to short3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))convert_short3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to short4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))convert_short4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to ushort2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))convert_ushort2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to ushort3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))convert_ushort3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to ushort4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))convert_ushort4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to int2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))convert_int2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to int3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))convert_int3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to int4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))convert_int4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to uint2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))convert_uint2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to uint3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))convert_uint3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to uint4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))convert_uint4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to long2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long2 __attribute__((const, overloadable))convert_long2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to long3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long3 __attribute__((const, overloadable))convert_long3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to long4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern long4 __attribute__((const, overloadable))convert_long4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from float4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(double2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(double3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from double4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(double4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(char2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(char3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from char4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(char4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(uchar2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(uchar3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uchar4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(uchar4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(short2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(short3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from short4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(short4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(ushort2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(ushort3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ushort4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(ushort4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from int4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(uint2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(uint3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from uint4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(uint4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(long2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(long3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from long4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(long4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong2 to ulong2
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))convert_ulong2(ulong2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong3 to ulong3
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))convert_ulong3(ulong3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Component wise conversion from ulong4 to ulong4
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))convert_ulong4(ulong4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acos
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))acos(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acos
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))acos(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acos
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))acos(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acos
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))acos(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acosh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))acosh(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acosh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))acosh(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acosh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))acosh(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acosh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))acosh(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acospi
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))acospi(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acospi
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))acospi(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acospi
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))acospi(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * acospi
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))acospi(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asin
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))asin(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asin
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))asin(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asin
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))asin(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asin
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))asin(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asinh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))asinh(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asinh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))asinh(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asinh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))asinh(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * asinh
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))asinh(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse sine divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))asinpi(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse sine divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))asinpi(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse sine divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))asinpi(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse sine divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))asinpi(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))atan(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))atan(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))atan(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))atan(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))atan2(float y, float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))atan2(float2 y, float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))atan2(float3 y, float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))atan2(float4 y, float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse hyperbolic tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))atanh(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse hyperbolic tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))atanh(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse hyperbolic tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))atanh(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse hyperbolic tangent.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))atanh(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))atanpi(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))atanpi(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))atanpi(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))atanpi(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x, divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))atan2pi(float y, float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x, divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))atan2pi(float2 y, float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x, divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))atan2pi(float3 y, float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the inverse tangent of y / x, divided by PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))atan2pi(float4 y, float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cube root.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))cbrt(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cube root.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))cbrt(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cube root.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))cbrt(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cube root.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))cbrt(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not less than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))ceil(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not less than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))ceil(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not less than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))ceil(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not less than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))ceil(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Copy the sign bit from y to x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))copysign(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Copy the sign bit from y to x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))copysign(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Copy the sign bit from y to x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))copysign(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Copy the sign bit from y to x.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))copysign(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))cos(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))cos(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))cos(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))cos(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hypebolic cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))cosh(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hypebolic cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))cosh(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hypebolic cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))cosh(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hypebolic cosine.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))cosh(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine of the value * PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))cospi(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine of the value * PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))cospi(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine of the value * PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))cospi(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the cosine of the value * PI.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))cospi(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the complementary error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))erfc(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the complementary error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))erfc(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the complementary error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))erfc(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the complementary error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))erfc(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))erf(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))erf(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))erf(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the error function.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))erf(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return e ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))exp(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return e ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))exp(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return e ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))exp(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return e ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))exp(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 2 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))exp2(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 2 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))exp2(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 2 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))exp2(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 2 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))exp2(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 10 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))exp10(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 10 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))exp10(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 10 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))exp10(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return 10 ^ value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))exp10(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (e ^ value) - 1.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))expm1(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (e ^ value) - 1.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))expm1(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (e ^ value) - 1.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))expm1(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (e ^ value) - 1.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))expm1(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fabs(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fabs(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fabs(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fabs(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the positive difference between two values.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fdim(float, float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the positive difference between two values.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fdim(float2, float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the positive difference between two values.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fdim(float3, float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the positive difference between two values.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fdim(float4, float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not greater than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))floor(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not greater than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))floor(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not greater than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))floor(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the smallest integer not greater than a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))floor(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (a * b) + c.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fma(float a, float b, float c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (a * b) + c.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fma(float2 a, float2 b, float2 c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (a * b) + c.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fma(float3 a, float3 b, float3 c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (a * b) + c.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fma(float4 a, float4 b, float4 c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fmax(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fmax(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fmax(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fmax(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fmax(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fmax(float2 x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fmax(float3 x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x < y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fmax(float4 x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fmin(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fmin(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fmin(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fmin(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fmin(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fmin(float2 x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fmin(float3 x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x > y ? y : x)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fmin(float4 x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the remainder from x / y
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fmod(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the remainder from x / y
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fmod(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the remainder from x / y
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fmod(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the remainder from x / y
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fmod(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * @param iptr  iptr[0] will be set to the floor of the input value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))fract(float v, float *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * @param iptr  iptr[0] will be set to the floor of the input value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fract(float2 v, float2 *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * @param iptr  iptr[0] will be set to the floor of the input value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fract(float3 v, float3 *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * @param iptr  iptr[0] will be set to the floor of the input value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fract(float4 v, float4 *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * Supported by API versions 9 and newer.
+ */
+static float __attribute__((const, overloadable))fract(float v) {
+ float unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * Supported by API versions 9 and newer.
+ */
+static float2 __attribute__((const, overloadable))fract(float2 v) {
+ float2 unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * Supported by API versions 9 and newer.
+ */
+static float3 __attribute__((const, overloadable))fract(float3 v) {
+ float3 unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return fractional part of v
+ *
+ * Supported by API versions 9 and newer.
+ */
+static float4 __attribute__((const, overloadable))fract(float4 v) {
+ float4 unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the mantissa and place the exponent into iptr[0]
+ *
+ * @param v Supports float, float2, float3, float4.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))frexp(float v, int *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the mantissa and place the exponent into iptr[0]
+ *
+ * @param v Supports float, float2, float3, float4.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))frexp(float2 v, int2 *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the mantissa and place the exponent into iptr[0]
+ *
+ * @param v Supports float, float2, float3, float4.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))frexp(float3 v, int3 *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the mantissa and place the exponent into iptr[0]
+ *
+ * @param v Supports float, float2, float3, float4.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))frexp(float4 v, int4 *iptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return sqrt(x*x + y*y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))hypot(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return sqrt(x*x + y*y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))hypot(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return sqrt(x*x + y*y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))hypot(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return sqrt(x*x + y*y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))hypot(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integer exponent of a value
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int __attribute__((const, overloadable))ilogb(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integer exponent of a value
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))ilogb(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integer exponent of a value
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))ilogb(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integer exponent of a value
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))ilogb(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))ilogb(float, int);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))ilogb(float2, int2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))ilogb(float3, int3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))ilogb(float4, int4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))ilogb(float, int);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))ilogb(float2, int);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))ilogb(float3, int);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))ilogb(float4, int);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * @param x Supports 1,2,3,4 components
+ * @param y Supports single component or matching vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))ldexp(float x, int y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * @param x Supports 1,2,3,4 components
+ * @param y Supports single component or matching vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))ldexp(float2 x, int2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * @param x Supports 1,2,3,4 components
+ * @param y Supports single component or matching vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))ldexp(float3 x, int3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * @param x Supports 1,2,3,4 components
+ * @param y Supports single component or matching vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))ldexp(float4 x, int4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * @param x Supports 1,2,3,4 components
+ * @param y Supports single component or matching vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))ldexp(float2 x, int y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * @param x Supports 1,2,3,4 components
+ * @param y Supports single component or matching vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))ldexp(float3 x, int y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (x * 2^y)
+ *
+ * @param x Supports 1,2,3,4 components
+ * @param y Supports single component or matching vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))ldexp(float4 x, int y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))lgamma(float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))lgamma(float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))lgamma(float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))lgamma(float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))lgamma(float x, int *y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))lgamma(float2 x, int2 *y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))lgamma(float3 x, int3 *y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the log gamma and sign
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))lgamma(float4 x, int4 *y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))log(float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))log(float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))log(float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))log(float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 2 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))log2(float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 2 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))log2(float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 2 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))log2(float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 2 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))log2(float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 10 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))log10(float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 10 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))log10(float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 10 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))log10(float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the base 10 logarithm.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))log10(float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm of (v + 1.0f)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))log1p(float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm of (v + 1.0f)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))log1p(float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm of (v + 1.0f)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))log1p(float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the natural logarithm of (v + 1.0f)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))log1p(float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the exponent of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))logb(float x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the exponent of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))logb(float2 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the exponent of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))logb(float3 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the exponent of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))logb(float4 x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute (a * b) + c
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))mad(float a, float b, float c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute (a * b) + c
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))mad(float2 a, float2 b, float2 c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute (a * b) + c
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))mad(float3 a, float3 b, float3 c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute (a * b) + c
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))mad(float4 a, float4 b, float4 c);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integral and fractional components of a number.
+ *
+ * @param x Source value
+ * @param iret iret[0] will be set to the integral portion of the number.
+ * @return The floating point portion of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))modf(float x, float *iret);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integral and fractional components of a number.
+ *
+ * @param x Source value
+ * @param iret iret[0] will be set to the integral portion of the number.
+ * @return The floating point portion of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))modf(float2 x, float2 *iret);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integral and fractional components of a number.
+ *
+ * @param x Source value
+ * @param iret iret[0] will be set to the integral portion of the number.
+ * @return The floating point portion of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))modf(float3 x, float3 *iret);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the integral and fractional components of a number.
+ *
+ * @param x Source value
+ * @param iret iret[0] will be set to the integral portion of the number.
+ * @return The floating point portion of the value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))modf(float4 x, float4 *iret);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * generate a nan
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))nan(uint);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the next floating point number from x towards y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))nextafter(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the next floating point number from x towards y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))nextafter(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the next floating point number from x towards y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))nextafter(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the next floating point number from x towards y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))nextafter(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))pow(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))pow(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))pow(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))pow(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))pown(float x, int y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))pown(float2 x, int2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))pown(float3 x, int3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))pown(float4 x, int4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ * y must be > 0
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))powr(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ * y must be > 0
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))powr(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ * y must be > 0
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))powr(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return x ^ y.
+ * y must be > 0
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))powr(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return round x/y to the nearest integer then compute the remander.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))remainder(float x, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return round x/y to the nearest integer then compute the remander.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))remainder(float2 x, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return round x/y to the nearest integer then compute the remander.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))remainder(float3 x, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return round x/y to the nearest integer then compute the remander.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))remainder(float4 x, float4 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * todo
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))remquo(float, float, int *);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * todo
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))remquo(float2, float2, int2 *);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * todo
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))remquo(float3, float3, int3 *);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * todo
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))remquo(float4, float4, int4 *);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))rint(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))rint(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))rint(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))rint(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the Nth root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))rootn(float v, int n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the Nth root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))rootn(float2 v, int2 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the Nth root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))rootn(float3 v, int3 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the Nth root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))rootn(float4 v, int4 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.  Half values are rounded away from zero.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))round(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.  Half values are rounded away from zero.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))round(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.  Half values are rounded away from zero.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))round(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Round to the nearest integral value.  Half values are rounded away from zero.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))round(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (1 / sqrt(value)).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))rsqrt(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (1 / sqrt(value)).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))rsqrt(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (1 / sqrt(value)).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))rsqrt(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return (1 / sqrt(value)).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))rsqrt(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the square root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))sqrt(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the square root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))sqrt(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the square root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))sqrt(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the square root of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))sqrt(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))sin(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))sin(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))sin(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))sin(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine and cosine of a value.
+ *
+ * @return sine
+ * @param v The incoming value in radians
+ * @param *cosptr cosptr[0] will be set to the cosine value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))sincos(float v, float *cosptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine and cosine of a value.
+ *
+ * @return sine
+ * @param v The incoming value in radians
+ * @param *cosptr cosptr[0] will be set to the cosine value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))sincos(float2 v, float2 *cosptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine and cosine of a value.
+ *
+ * @return sine
+ * @param v The incoming value in radians
+ * @param *cosptr cosptr[0] will be set to the cosine value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))sincos(float3 v, float3 *cosptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sine and cosine of a value.
+ *
+ * @return sine
+ * @param v The incoming value in radians
+ * @param *cosptr cosptr[0] will be set to the cosine value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))sincos(float4 v, float4 *cosptr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))sinh(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))sinh(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))sinh(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic sine of a value specified in radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))sinh(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sin(v * PI).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))sinpi(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sin(v * PI).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))sinpi(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sin(v * PI).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))sinpi(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sin(v * PI).
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))sinpi(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))tan(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))tan(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))tan(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))tan(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))tanh(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))tanh(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))tanh(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the hyperbolic tangent of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))tanh(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return tan(v * PI)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))tanpi(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return tan(v * PI)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))tanpi(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return tan(v * PI)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))tanpi(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return tan(v * PI)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))tanpi(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the gamma function of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))tgamma(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the gamma function of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))tgamma(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the gamma function of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))tgamma(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the gamma function of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))tgamma(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * ound to integral using truncation.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))trunc(float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * ound to integral using truncation.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))trunc(float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * ound to integral using truncation.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))trunc(float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * ound to integral using truncation.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))trunc(float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar __attribute__((const, overloadable))abs(char value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))abs(char2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))abs(char3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))abs(char4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort __attribute__((const, overloadable))abs(short value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))abs(short2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))abs(short3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))abs(short4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint __attribute__((const, overloadable))abs(int value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))abs(int2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))abs(int3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the absolute value of a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))abs(int4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char __attribute__((const, overloadable))clz(char value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char2 __attribute__((const, overloadable))clz(char2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char3 __attribute__((const, overloadable))clz(char3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern char4 __attribute__((const, overloadable))clz(char4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar __attribute__((const, overloadable))clz(uchar value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))clz(uchar2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))clz(uchar3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))clz(uchar4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short __attribute__((const, overloadable))clz(short value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short2 __attribute__((const, overloadable))clz(short2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short3 __attribute__((const, overloadable))clz(short3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern short4 __attribute__((const, overloadable))clz(short4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort __attribute__((const, overloadable))clz(ushort value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))clz(ushort2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))clz(ushort3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))clz(ushort4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int __attribute__((const, overloadable))clz(int value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int2 __attribute__((const, overloadable))clz(int2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int3 __attribute__((const, overloadable))clz(int3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern int4 __attribute__((const, overloadable))clz(int4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint __attribute__((const, overloadable))clz(uint value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))clz(uint2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))clz(uint3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the number of leading 0-bits in a value.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))clz(uint4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))min(float, float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))min(float2, float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))min(float3, float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))min(float4, float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char __attribute__((const, overloadable))min(char v1, char v2) {
+ return (v1 < v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar __attribute__((const, overloadable))min(uchar v1, uchar v2) {
+ return (v1 < v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short __attribute__((const, overloadable))min(short v1, short v2) {
+ return (v1 < v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort __attribute__((const, overloadable))min(ushort v1, ushort v2) {
+ return (v1 < v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int __attribute__((const, overloadable))min(int v1, int v2) {
+ return (v1 < v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint __attribute__((const, overloadable))min(uint v1, uint v2) {
+ return (v1 < v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char2 __attribute__((const, overloadable))min(char2 v1, char2 v2) {
+ char2 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar2 __attribute__((const, overloadable))min(uchar2 v1, uchar2 v2) {
+ uchar2 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short2 __attribute__((const, overloadable))min(short2 v1, short2 v2) {
+ short2 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort2 __attribute__((const, overloadable))min(ushort2 v1, ushort2 v2) {
+ ushort2 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int2 __attribute__((const, overloadable))min(int2 v1, int2 v2) {
+ int2 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint2 __attribute__((const, overloadable))min(uint2 v1, uint2 v2) {
+ uint2 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char3 __attribute__((const, overloadable))min(char3 v1, char3 v2) {
+ char3 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar3 __attribute__((const, overloadable))min(uchar3 v1, uchar3 v2) {
+ uchar3 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short3 __attribute__((const, overloadable))min(short3 v1, short3 v2) {
+ short3 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort3 __attribute__((const, overloadable))min(ushort3 v1, ushort3 v2) {
+ ushort3 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int3 __attribute__((const, overloadable))min(int3 v1, int3 v2) {
+ int3 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint3 __attribute__((const, overloadable))min(uint3 v1, uint3 v2) {
+ uint3 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char4 __attribute__((const, overloadable))min(char4 v1, char4 v2) {
+ char4 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w < v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar4 __attribute__((const, overloadable))min(uchar4 v1, uchar4 v2) {
+ uchar4 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w < v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short4 __attribute__((const, overloadable))min(short4 v1, short4 v2) {
+ short4 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w < v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort4 __attribute__((const, overloadable))min(ushort4 v1, ushort4 v2) {
+ ushort4 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w < v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int4 __attribute__((const, overloadable))min(int4 v1, int4 v2) {
+ int4 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w < v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint4 __attribute__((const, overloadable))min(uint4 v1, uint4 v2) {
+ uint4 tmp;
+ tmp.x = (v1.x < v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y < v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z < v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w < v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char __attribute__((const, overloadable))min(char v1, char v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char2 __attribute__((const, overloadable))min(char2 v1, char2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char3 __attribute__((const, overloadable))min(char3 v1, char3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char4 __attribute__((const, overloadable))min(char4 v1, char4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar __attribute__((const, overloadable))min(uchar v1, uchar v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))min(uchar2 v1, uchar2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))min(uchar3 v1, uchar3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))min(uchar4 v1, uchar4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short __attribute__((const, overloadable))min(short v1, short v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short2 __attribute__((const, overloadable))min(short2 v1, short2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short3 __attribute__((const, overloadable))min(short3 v1, short3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short4 __attribute__((const, overloadable))min(short4 v1, short4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort __attribute__((const, overloadable))min(ushort v1, ushort v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))min(ushort2 v1, ushort2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))min(ushort3 v1, ushort3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))min(ushort4 v1, ushort4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int __attribute__((const, overloadable))min(int v1, int v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int2 __attribute__((const, overloadable))min(int2 v1, int2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int3 __attribute__((const, overloadable))min(int3 v1, int3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int4 __attribute__((const, overloadable))min(int4 v1, int4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint __attribute__((const, overloadable))min(uint v1, uint v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))min(uint2 v1, uint2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))min(uint3 v1, uint3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))min(uint4 v1, uint4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long __attribute__((const, overloadable))min(long v1, long v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long2 __attribute__((const, overloadable))min(long2 v1, long2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long3 __attribute__((const, overloadable))min(long3 v1, long3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long4 __attribute__((const, overloadable))min(long4 v1, long4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong __attribute__((const, overloadable))min(ulong v1, ulong v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))min(ulong2 v1, ulong2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))min(ulong3 v1, ulong3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the minimum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))min(ulong4 v1, ulong4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))max(float, float);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))max(float2, float2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))max(float3, float3);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))max(float4, float4);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char __attribute__((const, overloadable))max(char v1, char v2) {
+ return (v1 > v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar __attribute__((const, overloadable))max(uchar v1, uchar v2) {
+ return (v1 > v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short __attribute__((const, overloadable))max(short v1, short v2) {
+ return (v1 > v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort __attribute__((const, overloadable))max(ushort v1, ushort v2) {
+ return (v1 > v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int __attribute__((const, overloadable))max(int v1, int v2) {
+ return (v1 > v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint __attribute__((const, overloadable))max(uint v1, uint v2) {
+ return (v1 > v2 ? v1 : v2);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char2 __attribute__((const, overloadable))max(char2 v1, char2 v2) {
+ char2 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar2 __attribute__((const, overloadable))max(uchar2 v1, uchar2 v2) {
+ uchar2 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short2 __attribute__((const, overloadable))max(short2 v1, short2 v2) {
+ short2 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort2 __attribute__((const, overloadable))max(ushort2 v1, ushort2 v2) {
+ ushort2 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int2 __attribute__((const, overloadable))max(int2 v1, int2 v2) {
+ int2 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint2 __attribute__((const, overloadable))max(uint2 v1, uint2 v2) {
+ uint2 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char3 __attribute__((const, overloadable))max(char3 v1, char3 v2) {
+ char3 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar3 __attribute__((const, overloadable))max(uchar3 v1, uchar3 v2) {
+ uchar3 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short3 __attribute__((const, overloadable))max(short3 v1, short3 v2) {
+ short3 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort3 __attribute__((const, overloadable))max(ushort3 v1, ushort3 v2) {
+ ushort3 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int3 __attribute__((const, overloadable))max(int3 v1, int3 v2) {
+ int3 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint3 __attribute__((const, overloadable))max(uint3 v1, uint3 v2) {
+ uint3 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static char4 __attribute__((const, overloadable))max(char4 v1, char4 v2) {
+ char4 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w > v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uchar4 __attribute__((const, overloadable))max(uchar4 v1, uchar4 v2) {
+ uchar4 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w > v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static short4 __attribute__((const, overloadable))max(short4 v1, short4 v2) {
+ short4 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w > v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static ushort4 __attribute__((const, overloadable))max(ushort4 v1, ushort4 v2) {
+ ushort4 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w > v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static int4 __attribute__((const, overloadable))max(int4 v1, int4 v2) {
+ int4 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w > v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 19))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Suppored by API versions 9 - 19
+ */
+static uint4 __attribute__((const, overloadable))max(uint4 v1, uint4 v2) {
+ uint4 tmp;
+ tmp.x = (v1.x > v2.x ? v1.x : v2.x);
+ tmp.y = (v1.y > v2.y ? v1.y : v2.y);
+ tmp.z = (v1.z > v2.z ? v1.z : v2.z);
+ tmp.w = (v1.w > v2.w ? v1.w : v2.w);
+ return tmp;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char __attribute__((const, overloadable))max(char v1, char v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char2 __attribute__((const, overloadable))max(char2 v1, char2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char3 __attribute__((const, overloadable))max(char3 v1, char3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern char4 __attribute__((const, overloadable))max(char4 v1, char4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar __attribute__((const, overloadable))max(uchar v1, uchar v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))max(uchar2 v1, uchar2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))max(uchar3 v1, uchar3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))max(uchar4 v1, uchar4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short __attribute__((const, overloadable))max(short v1, short v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short2 __attribute__((const, overloadable))max(short2 v1, short2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short3 __attribute__((const, overloadable))max(short3 v1, short3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern short4 __attribute__((const, overloadable))max(short4 v1, short4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort __attribute__((const, overloadable))max(ushort v1, ushort v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))max(ushort2 v1, ushort2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))max(ushort3 v1, ushort3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))max(ushort4 v1, ushort4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int __attribute__((const, overloadable))max(int v1, int v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int2 __attribute__((const, overloadable))max(int2 v1, int2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int3 __attribute__((const, overloadable))max(int3 v1, int3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern int4 __attribute__((const, overloadable))max(int4 v1, int4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint __attribute__((const, overloadable))max(uint v1, uint v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))max(uint2 v1, uint2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))max(uint3 v1, uint3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))max(uint4 v1, uint4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long __attribute__((const, overloadable))max(long v1, long v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long2 __attribute__((const, overloadable))max(long2 v1, long2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long3 __attribute__((const, overloadable))max(long3 v1, long3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern long4 __attribute__((const, overloadable))max(long4 v1, long4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong __attribute__((const, overloadable))max(ulong v1, ulong v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))max(ulong2 v1, ulong2 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))max(ulong3 v1, ulong3 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+/*
+ * Return the maximum value from two arguments
+ *
+ * Supported by API versions 20 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))max(ulong4 v1, ulong4 v2);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))clamp(float value, float min_value, float max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))clamp(float2 value, float2 min_value, float2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))clamp(float3 value, float3 min_value, float3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))clamp(float4 value, float4 min_value, float4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))clamp(float value, float min_value, float max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))clamp(float2 value, float min_value, float max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))clamp(float3 value, float min_value, float max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))clamp(float4 value, float min_value, float max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char __attribute__((const, overloadable))clamp(char value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char2 __attribute__((const, overloadable))clamp(char2 value, char2 min_value, char2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char3 __attribute__((const, overloadable))clamp(char3 value, char3 min_value, char3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char4 __attribute__((const, overloadable))clamp(char4 value, char4 min_value, char4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar __attribute__((const, overloadable))clamp(uchar value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))clamp(uchar2 value, uchar2 min_value, uchar2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))clamp(uchar3 value, uchar3 min_value, uchar3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))clamp(uchar4 value, uchar4 min_value, uchar4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short __attribute__((const, overloadable))clamp(short value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short2 __attribute__((const, overloadable))clamp(short2 value, short2 min_value, short2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short3 __attribute__((const, overloadable))clamp(short3 value, short3 min_value, short3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short4 __attribute__((const, overloadable))clamp(short4 value, short4 min_value, short4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort __attribute__((const, overloadable))clamp(ushort value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))clamp(ushort2 value, ushort2 min_value, ushort2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))clamp(ushort3 value, ushort3 min_value, ushort3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))clamp(ushort4 value, ushort4 min_value, ushort4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int __attribute__((const, overloadable))clamp(int value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int2 __attribute__((const, overloadable))clamp(int2 value, int2 min_value, int2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int3 __attribute__((const, overloadable))clamp(int3 value, int3 min_value, int3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int4 __attribute__((const, overloadable))clamp(int4 value, int4 min_value, int4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint __attribute__((const, overloadable))clamp(uint value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))clamp(uint2 value, uint2 min_value, uint2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))clamp(uint3 value, uint3 min_value, uint3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))clamp(uint4 value, uint4 min_value, uint4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long __attribute__((const, overloadable))clamp(long value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long2 __attribute__((const, overloadable))clamp(long2 value, long2 min_value, long2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long3 __attribute__((const, overloadable))clamp(long3 value, long3 min_value, long3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long4 __attribute__((const, overloadable))clamp(long4 value, long4 min_value, long4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong __attribute__((const, overloadable))clamp(ulong value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))clamp(ulong2 value, ulong2 min_value, ulong2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))clamp(ulong3 value, ulong3 min_value, ulong3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))clamp(ulong4 value, ulong4 min_value, ulong4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char __attribute__((const, overloadable))clamp(char value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char2 __attribute__((const, overloadable))clamp(char2 value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char3 __attribute__((const, overloadable))clamp(char3 value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern char4 __attribute__((const, overloadable))clamp(char4 value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar __attribute__((const, overloadable))clamp(uchar value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar2 __attribute__((const, overloadable))clamp(uchar2 value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar3 __attribute__((const, overloadable))clamp(uchar3 value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uchar4 __attribute__((const, overloadable))clamp(uchar4 value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short __attribute__((const, overloadable))clamp(short value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short2 __attribute__((const, overloadable))clamp(short2 value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short3 __attribute__((const, overloadable))clamp(short3 value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern short4 __attribute__((const, overloadable))clamp(short4 value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort __attribute__((const, overloadable))clamp(ushort value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort2 __attribute__((const, overloadable))clamp(ushort2 value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort3 __attribute__((const, overloadable))clamp(ushort3 value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ushort4 __attribute__((const, overloadable))clamp(ushort4 value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int __attribute__((const, overloadable))clamp(int value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int2 __attribute__((const, overloadable))clamp(int2 value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int3 __attribute__((const, overloadable))clamp(int3 value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern int4 __attribute__((const, overloadable))clamp(int4 value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint __attribute__((const, overloadable))clamp(uint value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint2 __attribute__((const, overloadable))clamp(uint2 value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint3 __attribute__((const, overloadable))clamp(uint3 value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern uint4 __attribute__((const, overloadable))clamp(uint4 value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long __attribute__((const, overloadable))clamp(long value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long2 __attribute__((const, overloadable))clamp(long2 value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long3 __attribute__((const, overloadable))clamp(long3 value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern long4 __attribute__((const, overloadable))clamp(long4 value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong __attribute__((const, overloadable))clamp(ulong value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong2 __attribute__((const, overloadable))clamp(ulong2 value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong3 __attribute__((const, overloadable))clamp(ulong3 value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+/*
+ * Clamp a value to a specified high and low bound.
+ *
+ * @param amount value to be clamped.  Supports 1,2,3,4 components
+ * @param min_value Lower bound, must be scalar or matching vector.
+ * @param max_value High bound, must match type of low
+ *
+ * Supported by API versions 19 and newer.
+ */
+extern ulong4 __attribute__((const, overloadable))clamp(ulong4 value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from radians to degrees.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))degrees(float value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from radians to degrees.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))degrees(float2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from radians to degrees.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))degrees(float3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from radians to degrees.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))degrees(float4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))mix(float start, float stop, float amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))mix(float2 start, float2 stop, float2 amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))mix(float3 start, float3 stop, float3 amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))mix(float4 start, float4 stop, float4 amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))mix(float start, float stop, float amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))mix(float2 start, float2 stop, float amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))mix(float3 start, float3 stop, float amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * return start + ((stop - start) * amount)
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))mix(float4 start, float4 stop, float amount);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from degrees to radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))radians(float value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from degrees to radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))radians(float2 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from degrees to radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))radians(float3 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Convert from degrees to radians.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))radians(float4 value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * if (v < edge)
+ * return 0.f;
+ * else
+ * return 1.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))step(float edge, float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * if (v < edge)
+ * return 0.f;
+ * else
+ * return 1.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))step(float2 edge, float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * if (v < edge)
+ * return 0.f;
+ * else
+ * return 1.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))step(float3 edge, float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * if (v < edge)
+ * return 0.f;
+ * else
+ * return 1.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))step(float4 edge, float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * if (v < edge)
+ * return 0.f;
+ * else
+ * return 1.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))step(float2 edge, float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * if (v < edge)
+ * return 0.f;
+ * else
+ * return 1.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))step(float3 edge, float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * if (v < edge)
+ * return 0.f;
+ * else
+ * return 1.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))step(float4 edge, float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sign of a value.
+ *
+ * if (v < 0) return -1.f;
+ * else if (v > 0) return 1.f;
+ * else return 0.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))sign(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sign of a value.
+ *
+ * if (v < 0) return -1.f;
+ * else if (v > 0) return 1.f;
+ * else return 0.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))sign(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sign of a value.
+ *
+ * if (v < 0) return -1.f;
+ * else if (v > 0) return 1.f;
+ * else return 0.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))sign(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Return the sign of a value.
+ *
+ * if (v < 0) return -1.f;
+ * else if (v > 0) return 1.f;
+ * else return 0.f;
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))sign(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the cross product of two vectors.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))cross(float3 lhs, float3 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the cross product of two vectors.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))cross(float4 lhs, float4 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the dot product of two vectors.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))dot(float lhs, float rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the dot product of two vectors.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))dot(float2 lhs, float2 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the dot product of two vectors.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))dot(float3 lhs, float3 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the dot product of two vectors.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))dot(float4 lhs, float4 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the length of a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))length(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the length of a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))length(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the length of a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))length(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the length of a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))length(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the distance between two points.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))distance(float lhs, float rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the distance between two points.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))distance(float2 lhs, float2 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the distance between two points.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))distance(float3 lhs, float3 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Compute the distance between two points.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))distance(float4 lhs, float4 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Normalize a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float __attribute__((const, overloadable))normalize(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Normalize a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float2 __attribute__((const, overloadable))normalize(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Normalize a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float3 __attribute__((const, overloadable))normalize(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 9))
+/*
+ * Normalize a vector.
+ *
+ * Supported by API versions 9 and newer.
+ */
+extern float4 __attribute__((const, overloadable))normalize(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate reciprocal of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))half_recip(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate reciprocal of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float2 __attribute__((const, overloadable))half_recip(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate reciprocal of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float3 __attribute__((const, overloadable))half_recip(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate reciprocal of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float4 __attribute__((const, overloadable))half_recip(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate square root of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))half_sqrt(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate square root of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float2 __attribute__((const, overloadable))half_sqrt(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate square root of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float3 __attribute__((const, overloadable))half_sqrt(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate square root of a value.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float4 __attribute__((const, overloadable))half_sqrt(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate value of (1.f / sqrt(value)).
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))half_rsqrt(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate value of (1.f / sqrt(value)).
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float2 __attribute__((const, overloadable))half_rsqrt(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate value of (1.f / sqrt(value)).
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float3 __attribute__((const, overloadable))half_rsqrt(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Return the approximate value of (1.f / sqrt(value)).
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float4 __attribute__((const, overloadable))half_rsqrt(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate length of a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_length(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate length of a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_length(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate length of a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_length(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate length of a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_length(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate distance between two points.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_distance(float lhs, float rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate distance between two points.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_distance(float2 lhs, float2 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate distance between two points.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_distance(float3 lhs, float3 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Compute the approximate distance between two points.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_distance(float4 lhs, float4 rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Approximately normalize a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float __attribute__((const, overloadable))fast_normalize(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Approximately normalize a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float2 __attribute__((const, overloadable))fast_normalize(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Approximately normalize a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float3 __attribute__((const, overloadable))fast_normalize(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+/*
+ * Approximately normalize a vector.
+ *
+ * Supported by API versions 17 and newer.
+ */
+extern float4 __attribute__((const, overloadable))fast_normalize(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp
+ * valid for inputs -86.f to 86.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float __attribute__((const, overloadable))native_exp(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp
+ * valid for inputs -86.f to 86.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float2 __attribute__((const, overloadable))native_exp(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp
+ * valid for inputs -86.f to 86.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float3 __attribute__((const, overloadable))native_exp(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp
+ * valid for inputs -86.f to 86.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float4 __attribute__((const, overloadable))native_exp(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp2
+ * valid for inputs -125.f to 125.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float __attribute__((const, overloadable))native_exp2(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp2
+ * valid for inputs -125.f to 125.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float2 __attribute__((const, overloadable))native_exp2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp2
+ * valid for inputs -125.f to 125.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float3 __attribute__((const, overloadable))native_exp2(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp2
+ * valid for inputs -125.f to 125.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float4 __attribute__((const, overloadable))native_exp2(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp10
+ * valid for inputs -37.f to 37.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float __attribute__((const, overloadable))native_exp10(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp10
+ * valid for inputs -37.f to 37.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float2 __attribute__((const, overloadable))native_exp10(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp10
+ * valid for inputs -37.f to 37.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float3 __attribute__((const, overloadable))native_exp10(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate exp10
+ * valid for inputs -37.f to 37.f
+ * Max 8192 ulps of error
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float4 __attribute__((const, overloadable))native_exp10(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float __attribute__((const, overloadable))native_log(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float2 __attribute__((const, overloadable))native_log(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float3 __attribute__((const, overloadable))native_log(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float4 __attribute__((const, overloadable))native_log(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log2
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float __attribute__((const, overloadable))native_log2(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log2
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float2 __attribute__((const, overloadable))native_log2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log2
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float3 __attribute__((const, overloadable))native_log2(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log2
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float4 __attribute__((const, overloadable))native_log2(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log10
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float __attribute__((const, overloadable))native_log10(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log10
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float2 __attribute__((const, overloadable))native_log10(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log10
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float3 __attribute__((const, overloadable))native_log10(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate log10
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float4 __attribute__((const, overloadable))native_log10(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate v ^ y
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float __attribute__((const, overloadable))native_powr(float v, float y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate v ^ y
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float2 __attribute__((const, overloadable))native_powr(float2 v, float2 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate v ^ y
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float3 __attribute__((const, overloadable))native_powr(float3 v, float3 y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * Fast approximate v ^ y
+ *
+ * Supported by API versions 18 and newer.
+ */
+extern float4 __attribute__((const, overloadable))native_powr(float4 v, float4 y);
+#endif
+
+#endif // __rs_core_math_rsh__
diff --git a/update_rs_prebuilts.sh b/update_rs_prebuilts.sh
index 7e6631e..b592a1f 100755
--- a/update_rs_prebuilts.sh
+++ b/update_rs_prebuilts.sh
@@ -4,8 +4,29 @@
 MY_ANDROID_DIR=$PWD/../../
 cd $MY_ANDROID_DIR
 
+if [ $OSTYPE == 'darwin13' ];
+then
+
+  DARWIN=1
+  SHORT_OSNAME=darwin
+  SONAME=dylib
+  # Only build arm on darwin.
+  TARGETS=(arm)
+  SYS_NAMES=(generic)
+
+else
+
+  DARWIN=0
+  SHORT_OSNAME=linux
+  SONAME=so
+  # Target architectures and their system library names.
+  TARGETS=(arm mips x86)
+  SYS_NAMES=(generic generic_mips generic_x86)
+
+fi
+
 # ANDROID_HOST_OUT is where the new prebuilts will be constructed/copied from.
-ANDROID_HOST_OUT=$MY_ANDROID_DIR/out/host/linux-x86/
+ANDROID_HOST_OUT=$MY_ANDROID_DIR/out/host/$SHORT_OSNAME-x86/
 
 # HOST_LIB_DIR allows us to pick up the built librsrt_*.bc libraries.
 HOST_LIB_DIR=$ANDROID_HOST_OUT/lib
@@ -13,10 +34,6 @@
 # PREBUILTS_DIR is where we want to copy our new files to.
 PREBUILTS_DIR=$MY_ANDROID_DIR/prebuilts/sdk/
 
-# Target architectures and their system library names.
-TARGETS=(arm mips x86)
-SYS_NAMES=(generic generic_mips generic_x86)
-
 print_usage() {
   echo "USAGE: $0 [-h|--help] [-n|--no-build] [-x]"
   echo "OPTIONS:"
@@ -85,50 +102,55 @@
 cd $PREBUILTS_DIR || exit 3
 repo start pb_$DATE .
 
-for i in $(seq 0 $((${#TARGETS[@]} - 1))); do
-  t=${TARGETS[$i]}
-  sys_lib_dir=$MY_ANDROID_DIR/out/target/product/${SYS_NAMES[$i]}/system/lib
-  for a in `find renderscript/lib/$t -name \*.so`; do
-    file=`basename $a`
-    cp `find $sys_lib_dir -name $file` $a || exit 4
+# Don't copy device prebuilts on Darwin. We don't need/use them.
+if [ $DARWIN -eq 0 ]; then
+  for i in $(seq 0 $((${#TARGETS[@]} - 1))); do
+    t=${TARGETS[$i]}
+    sys_lib_dir=$MY_ANDROID_DIR/out/target/product/${SYS_NAMES[$i]}/system/lib
+    for a in `find renderscript/lib/$t -name \*.so`; do
+      file=`basename $a`
+      cp `find $sys_lib_dir -name $file` $a || exit 4
+    done
+
+    for a in `find renderscript/lib/$t -name \*.bc`; do
+      file=`basename $a`
+      cp `find $HOST_LIB_DIR $sys_lib_dir -name $file` $a || exit 5
+    done
   done
 
-  for a in `find renderscript/lib/$t -name \*.bc`; do
-    file=`basename $a`
-    cp `find $HOST_LIB_DIR $sys_lib_dir -name $file` $a || exit 5
-  done
-done
+  # javalib.jar
+  cp $MY_ANDROID_DIR/out/target/common/obj/JAVA_LIBRARIES/android-support-v8-renderscript_intermediates/javalib.jar renderscript/lib
 
-# general
-# javalib.jar
-cp $MY_ANDROID_DIR/out/target/common/obj/JAVA_LIBRARIES/android-support-v8-renderscript_intermediates/javalib.jar renderscript/lib
+fi
 
 # Copy header files for compilers
 cp $MY_ANDROID_DIR/external/clang/lib/Headers/*.h renderscript/clang-include
 cp $MY_ANDROID_DIR/frameworks/rs/scriptc/* renderscript/include
 
 
-# Linux-specific tools (bin/ and lib/)
+# Host-specific tools (bin/ and lib/)
 TOOLS_BIN="
 bcc_compat
 llvm-rs-cc
 "
 
 TOOLS_LIB="
-libbcc.so
-libbcinfo.so
-libclang.so
-libLLVM.so
+libbcc.$SONAME
+libbcinfo.$SONAME
+libclang.$SONAME
+libLLVM.$SONAME
 "
 
 for a in $TOOLS_BIN; do
-  cp $ANDROID_HOST_OUT/bin/$a tools/linux/
-  strip tools/linux/$a
+  cp $ANDROID_HOST_OUT/bin/$a tools/$SHORT_OSNAME/
+  strip tools/$SHORT_OSNAME/$a
 done
 
 for a in $TOOLS_LIB; do
-  cp $ANDROID_HOST_OUT/lib/$a tools/linux/
-  strip tools/linux/$a
+  cp $ANDROID_HOST_OUT/lib/$a tools/$SHORT_OSNAME/
+  strip tools/$SHORT_OSNAME/$a
 done
 
-echo "DON'T FORGET TO UPDATE THE DARWIN COMPILER PREBUILTS!!!"
+if [ $DARWIN -eq 0 ]; then
+  echo "DON'T FORGET TO UPDATE THE DARWIN COMPILER PREBUILTS!!!"
+fi