sk_c_from_to.h revision f5872d2f416b17db405f501a910ca0a4bd96f6e2
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8static bool find_sk(CType from, SKType* to) {
9    for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
10        if (CTypeSkTypeMap[i].fC == from) {
11            if (to) {
12                *to = CTypeSkTypeMap[i].fSK;
13            }
14            return true;
15        }
16    }
17    return false;
18}
19
20static bool find_c(SKType from, CType* to) {
21    for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
22        if (CTypeSkTypeMap[i].fSK == from) {
23            if (to) {
24                *to = CTypeSkTypeMap[i].fC;
25            }
26            return true;
27        }
28    }
29    return false;
30}
31
32#undef CType
33#undef SKType
34#undef CTypeSkTypeMap
35