summaryrefslogtreecommitdiff
path: root/tnslc/utils.tnsl
blob: 6fe77696510bfcfbe9e22f7575840b7f69ad4107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/; cstr_len (~uint8 cstr) [int]
    int i = 0
    /; loop (cstr{i} !== 0) [i++] ;/
    return i
;/

/; cstr_eq (~uint8 a, b) [bool]
    int ln = cstr_len(a)
    /; if (ln !== cstr_len(b))
        return false
    ;/

    /; loop (int i = 0; i < ln) [i++]
        /; if (a{i} !== b{i})
            return false
        ;/
    ;/

    return true
;/