aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/c/sk_c_from_to.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/sk_c_from_to.h')
-rw-r--r--src/c/sk_c_from_to.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/c/sk_c_from_to.h b/src/c/sk_c_from_to.h
new file mode 100644
index 0000000000..19fda37a26
--- /dev/null
+++ b/src/c/sk_c_from_to.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+static bool find_sk(CType from, SKType* to) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
+ if (CTypeSkTypeMap[i].fC == from) {
+ if (to) {
+ *to = CTypeSkTypeMap[i].fSK;
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool find_c(SKType from, CType* to) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
+ if (CTypeSkTypeMap[i].fSK == from) {
+ if (to) {
+ *to = CTypeSkTypeMap[i].fC;
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+#undef CType
+#undef SKType
+#undef CTypeSkTypeMap