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] - Rev 774

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

void asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
{
    int k;
    unsigned char temp[4];
    if (len < 128) {
	if (ans != ((void *) 0))
	    ans[0] = (unsigned char) len;
	*ans_len = 1;
    } else {
	k = 0;
	while (len) {
	    temp[k++] = len & 0xFF;
	    len = len >> 8;
	}
	*ans_len = k + 1;
	if (ans != ((void *) 0)) {
	    ans[0] = ((unsigned char) k & 0x7F) + 128;
	    while (k--)
		ans[*ans_len - 1 - k] = temp[k];
	}
    }
}
 

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

powered by: WebSVN 2.1.0

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