Sigrid Solveig Haflínudóttiruse Plan 9 naming of integer types22b11e51 year agoHistory
32 lines · 577 B · C
RawDownload
#include "platform.h"#include "mp.h" // convert an mpint into a big endian byte array (most significant byte first; left adjusted)//   return number of bytes converted//   if p == nil, allocate and result arrayintmptobe(mpint *b, u8int *p, u32int n, u8int **pp){	u32int m; 	m = (mpsignif(b)+7)/8;	if(m == 0)		m++;	if(p == nil){		n = m;		p = MEM_ALLOC(n);		if(p == nil){			fprintf(stderr, "mptobe: no memory\n");			exit(2);		}	} else {		if(n < m)			return -1;		if(n > m)			memset(p+m, 0, n-m);	}	if(pp != nil)		*pp = p;	mptober(b, p, m);	return m;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t