OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [compile/] [20110401-1.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
void asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
2
{
3
    int k;
4
    unsigned char temp[4];
5
    if (len < 128) {
6
        if (ans != ((void *) 0))
7
            ans[0] = (unsigned char) len;
8
        *ans_len = 1;
9
    } else {
10
        k = 0;
11
        while (len) {
12
            temp[k++] = len & 0xFF;
13
            len = len >> 8;
14
        }
15
        *ans_len = k + 1;
16
        if (ans != ((void *) 0)) {
17
            ans[0] = ((unsigned char) k & 0x7F) + 128;
18
            while (k--)
19
                ans[*ans_len - 1 - k] = temp[k];
20
        }
21
    }
22
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.