aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/c/sk_c_from_to.h
blob: 19fda37a261695e0b78fa82c77f6562ba1dea6af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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